File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,29 @@ const prod = JSON.parse(JSON.stringify(yaml.load(file)));
8
8
const vars = prod . envVars as Record < string , string > ;
9
9
10
10
let PUBLIC_CONFIG = "" ;
11
- Object . entries ( vars ) . forEach ( ( [ key , value ] ) => {
12
- PUBLIC_CONFIG += `${ key } =\`${ value } \`\n` ;
13
- } ) ;
11
+
12
+ Object . entries ( vars )
13
+ // filter keys used in prod with the proxy
14
+ . filter ( ( [ key ] ) => ! [ "XFF_DEPTH" , "ADDRESS_HEADER" ] . includes ( key ) )
15
+ . forEach ( ( [ key , value ] ) => {
16
+ PUBLIC_CONFIG += `${ key } =\`${ value } \`\n` ;
17
+ } ) ;
14
18
15
19
const SECRET_CONFIG =
16
20
( fs . existsSync ( ".env.SECRET_CONFIG" )
17
21
? fs . readFileSync ( ".env.SECRET_CONFIG" , "utf8" )
18
22
: process . env . SECRET_CONFIG ) ?? "" ;
19
23
20
24
// Prepend the content of the env variable SECRET_CONFIG
21
- const full_config = `${ PUBLIC_CONFIG } \n${ SECRET_CONFIG } ` ;
25
+ let full_config = `${ PUBLIC_CONFIG } \n${ SECRET_CONFIG } ` ;
26
+
27
+ // replace the internal proxy url with the public endpoint
28
+ full_config = full_config . replaceAll (
29
+ "https://proxy.serverless.api-inference.huggingface.tech" ,
30
+ "https://api-inference.huggingface.co"
31
+ ) ;
32
+
33
+ console . log ( full_config ) ;
22
34
23
35
// Write full_config to .env.local
24
36
fs . writeFileSync ( ".env.local" , full_config ) ;
You can’t perform that action at this time.
0 commit comments