f2d90b38 commited on
Commit
414eef2
·
verified ·
1 Parent(s): 260d193

Upload 4 files

Browse files
Files changed (1) hide show
  1. start.sh +30 -0
start.sh CHANGED
@@ -17,8 +17,38 @@ CONFIG_PATH="${CONFIG_PATH:-/data/config.yaml}"
17
  AUTH_DIR="${AUTH_DIR:-/data/auth}"
18
 
19
  mkdir -p "$(dirname "${CONFIG_PATH}")" "${AUTH_DIR}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  if [ -f "${CONFIG_PATH}" ]; then
21
  ln -sf "${CONFIG_PATH}" /CLIProxyAPI/config.yaml
 
 
 
 
22
  fi
23
  if [ -e /root/.cli-proxy-api ] && [ ! -L /root/.cli-proxy-api ]; then
24
  rm -rf /root/.cli-proxy-api
 
17
  AUTH_DIR="${AUTH_DIR:-/data/auth}"
18
 
19
  mkdir -p "$(dirname "${CONFIG_PATH}")" "${AUTH_DIR}"
20
+ if [ -n "${CONFIG_CONTENT_B64:-}" ]; then
21
+ echo "Writing config from CONFIG_CONTENT_B64 to ${CONFIG_PATH}"
22
+ echo "${CONFIG_CONTENT_B64}" | base64 -d > "${CONFIG_PATH}"
23
+ elif [ -n "${CONFIG_CONTENT:-}" ]; then
24
+ echo "Writing config from CONFIG_CONTENT to ${CONFIG_PATH}"
25
+ printf '%s\n' "${CONFIG_CONTENT}" > "${CONFIG_PATH}"
26
+ fi
27
+
28
+ if [ ! -f "${CONFIG_PATH}" ]; then
29
+ for candidate in \
30
+ /CLIProxyAPI/config.yaml \
31
+ /CLIProxyAPI/config.yml \
32
+ /CLIProxyAPI/config.example.yaml \
33
+ /CLIProxyAPI/config.example.yml \
34
+ /CLIProxyAPI/config.sample.yaml \
35
+ /CLIProxyAPI/config.sample.yml \
36
+ /CLIProxyAPI/config.template.yaml \
37
+ /CLIProxyAPI/config.template.yml; do
38
+ if [ -f "${candidate}" ]; then
39
+ echo "Copying default config from ${candidate} to ${CONFIG_PATH}"
40
+ cp "${candidate}" "${CONFIG_PATH}"
41
+ break
42
+ fi
43
+ done
44
+ fi
45
+
46
  if [ -f "${CONFIG_PATH}" ]; then
47
  ln -sf "${CONFIG_PATH}" /CLIProxyAPI/config.yaml
48
+ elif [ -f "/CLIProxyAPI/config.yaml" ]; then
49
+ echo "Using existing /CLIProxyAPI/config.yaml"
50
+ else
51
+ echo "No config file found. Set CONFIG_CONTENT or mount CONFIG_PATH."
52
  fi
53
  if [ -e /root/.cli-proxy-api ] && [ ! -L /root/.cli-proxy-api ]; then
54
  rm -rf /root/.cli-proxy-api