1041006580 commited on
Commit
dada8a9
·
1 Parent(s): 2eb27bc

feat(docker): 支持通过环境变量配置Admin API Key

Browse files
Files changed (1) hide show
  1. entrypoint.sh +15 -1
entrypoint.sh CHANGED
@@ -1,7 +1,20 @@
1
  #!/bin/sh
2
 
3
  # 从环境变量生成 config.json
4
- cat > /app/config/config.json << EOF
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  {
6
  "host": "0.0.0.0",
7
  "port": 7860,
@@ -9,6 +22,7 @@ cat > /app/config/config.json << EOF
9
  "region": "${REGION:-us-east-1}"
10
  }
11
  EOF
 
12
 
13
  # 从环境变量生成 credentials.json
14
  # 支持单凭据模式
 
1
  #!/bin/sh
2
 
3
  # 从环境变量生成 config.json
4
+ if [ -n "${ADMIN_API_KEY}" ]; then
5
+ # 如果设置了 ADMIN_API_KEY,包含在配置中
6
+ cat > /app/config/config.json << EOF
7
+ {
8
+ "host": "0.0.0.0",
9
+ "port": 7860,
10
+ "apiKey": "${API_KEY:-sk-kiro-rs-default}",
11
+ "region": "${REGION:-us-east-1}",
12
+ "adminApiKey": "${ADMIN_API_KEY}"
13
+ }
14
+ EOF
15
+ else
16
+ # 否则不包含 adminApiKey
17
+ cat > /app/config/config.json << EOF
18
  {
19
  "host": "0.0.0.0",
20
  "port": 7860,
 
22
  "region": "${REGION:-us-east-1}"
23
  }
24
  EOF
25
+ fi
26
 
27
  # 从环境变量生成 credentials.json
28
  # 支持单凭据模式