nsarrazin HF staff commited on
Commit
1ae93cf
1 Parent(s): 5071731

Break up SECRET_CONFIG into individual secrets (#523)

Browse files
Files changed (2) hide show
  1. .env.template +3 -0
  2. scripts/updateProdEnv.ts +11 -10
.env.template CHANGED
@@ -144,6 +144,9 @@ PUBLIC_APP_DISCLAIMER=1
144
  RATE_LIMIT=16
145
  MESSAGES_BEFORE_LOGIN=1# how many messages a user can send in a conversation before having to login. set to 0 to force login right away
146
 
 
 
 
147
  # Not part of the .env but set as other variables in the space
148
  # ADDRESS_HEADER=X-Forwarded-For
149
  # XFF_DEPTH=2
 
144
  RATE_LIMIT=16
145
  MESSAGES_BEFORE_LOGIN=1# how many messages a user can send in a conversation before having to login. set to 0 to force login right away
146
 
147
+ PUBLIC_GOOGLE_ANALYTICS_ID=G-8Q63TH4CSL
148
+ PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID=UA-83738774-2
149
+
150
  # Not part of the .env but set as other variables in the space
151
  # ADDRESS_HEADER=X-Forwarded-For
152
  # XFF_DEPTH=2
scripts/updateProdEnv.ts CHANGED
@@ -1,21 +1,22 @@
1
  import fs from "fs";
2
 
3
- const HF_TOKEN = process.env.HF_TOKEN;
4
- const SECRET_CONFIG = fs.existsSync(".env.SECRET_CONFIG")
5
- ? fs.readFileSync(".env.SECRET_CONFIG", "utf8")
6
- : process.env.SECRET_CONFIG;
7
 
8
- if (!SECRET_CONFIG) {
9
- throw new Error(
10
- "SECRET_CONFIG is not defined. Please provide it either in a file or as an environment variable."
11
- );
12
- }
13
 
14
  // Read the content of the file .env.template
15
  const PUBLIC_CONFIG = fs.readFileSync(".env.template", "utf8");
16
 
17
  // Prepend the content of the env variable SECRET_CONFIG
18
- const full_config = `${PUBLIC_CONFIG}\n${SECRET_CONFIG}`;
 
 
 
 
 
19
 
20
  // Make an HTTP POST request to add the space secre
21
  fetch(`https://huggingface.co/api/spaces/huggingchat/chat-ui/secrets`, {
 
1
  import fs from "fs";
2
 
3
+ const HF_TOKEN = process.env.HF_TOKEN; // token used for pushing to hub
 
 
 
4
 
5
+ const SERPER_API_KEY = process.env.SERPER_API_KEY;
6
+ const OPENID_CONFIG = process.env.OPENID_CONFIG;
7
+ const MONGODB_URL = process.env.MONGODB_URL;
8
+ const HF_ACCESS_TOKEN = process.env.HF_ACCESS_TOKEN; // token used for API requests in prod
 
9
 
10
  // Read the content of the file .env.template
11
  const PUBLIC_CONFIG = fs.readFileSync(".env.template", "utf8");
12
 
13
  // Prepend the content of the env variable SECRET_CONFIG
14
+ const full_config = `${PUBLIC_CONFIG}
15
+ MONGODB_URL=${MONGODB_URL}
16
+ OPENID_CONFIG=${OPENID_CONFIG}
17
+ SERPER_API_KEY=${SERPER_API_KEY}
18
+ HF_ACCESS_TOKEN=${HF_ACCESS_TOKEN}
19
+ `;
20
 
21
  // Make an HTTP POST request to add the space secre
22
  fetch(`https://huggingface.co/api/spaces/huggingchat/chat-ui/secrets`, {