Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

updateLocalEnv.ts 614 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  1. import fs from "fs";
  2. const SECRET_CONFIG = fs.existsSync(".env.SECRET_CONFIG")
  3. ? fs.readFileSync(".env.SECRET_CONFIG", "utf8")
  4. : process.env.SECRET_CONFIG;
  5. if (!SECRET_CONFIG) {
  6. throw new Error(
  7. "SECRET_CONFIG is not defined. Please provide it either in a file or as an environment variable."
  8. );
  9. }
  10. // Read the content of the file .env.template
  11. const PUBLIC_CONFIG = fs.readFileSync(".env.template", "utf8");
  12. // Prepend the content of the env variable SECRET_CONFIG
  13. const full_config = `${PUBLIC_CONFIG}\n${SECRET_CONFIG}`;
  14. // Write full_config to .env.local
  15. fs.writeFileSync(".env.local", full_config);
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...