z90486091 commited on
Commit
9c5c2b2
·
1 Parent(s): 0e0683f
Files changed (1) hide show
  1. entrypoint.sh +6 -10
entrypoint.sh CHANGED
@@ -4,18 +4,14 @@ if [ -n "$HF_OPENCODE_PASSWORD" ]; then
4
  export OPENCODE_SERVER_PASSWORD="$HF_OPENCODE_PASSWORD"
5
  fi
6
 
7
- # Set custom configuration from environment variable
8
- if [ -n "$OC_CONFIG_JSON" ]; then
 
 
 
 
9
  export OPENCODE_CONFIG_CONTENT="$OC_CONFIG_JSON"
10
  fi
11
 
12
- # Ensure LITELLM_API_KEY is available for substitution
13
- if [ -n "$LITELLM_API_KEY" ]; then
14
- export LITELLM_API_KEY="$LITELLM_API_KEY"
15
- fi
16
-
17
- # Debug: Show environment variables are set
18
- echo "LITELLM_API_KEY is set: ${LITELLM_API_KEY:0:10}..."
19
-
20
  # Execute opencode with passed arguments
21
  exec opencode "$@"
 
4
  export OPENCODE_SERVER_PASSWORD="$HF_OPENCODE_PASSWORD"
5
  fi
6
 
7
+ # Set custom configuration with actual API key substitution
8
+ if [ -n "$OC_CONFIG_JSON" ] && [ -n "$LITELLM_API_KEY" ]; then
9
+ # Replace {env:LITELLM_API_KEY} with actual value
10
+ CONFIG_CONTENT=$(echo "$OC_CONFIG_JSON" | sed "s/{env:LITELLM_API_KEY}/$LITELLM_API_KEY/g")
11
+ export OPENCODE_CONFIG_CONTENT="$CONFIG_CONTENT"
12
+ elif [ -n "$OC_CONFIG_JSON" ]; then
13
  export OPENCODE_CONFIG_CONTENT="$OC_CONFIG_JSON"
14
  fi
15
 
 
 
 
 
 
 
 
 
16
  # Execute opencode with passed arguments
17
  exec opencode "$@"