Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: docker - Update bindings.sh to Use Environment Variables Directly #222

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,31 @@

bindings=""

while IFS= read -r line || [ -n "$line" ]; do
if [[ ! "$line" =~ ^# ]] && [[ -n "$line" ]]; then
name=$(echo "$line" | cut -d '=' -f 1)
value=$(echo "$line" | cut -d '=' -f 2-)
value=$(echo $value | sed 's/^"\(.*\)"$/\1/')
bindings+="--binding ${name}=${value} "
# List all the environment variables you need
keys=(
"GROQ_API_KEY"
"OPENAI_API_KEY"
"ANTHROPIC_API_KEY"
"OPEN_ROUTER_API_KEY"
"GOOGLE_GENERATIVE_AI_API_KEY"
"OLLAMA_API_BASE_URL"
"OPENAI_LIKE_API_BASE_URL"
"DEEPSEEK_API_KEY"
"OPENAI_LIKE_API_KEY"
"MISTRAL_API_KEY"
"XAI_API_KEY"
"VITE_LOG_LEVEL"
)

# Iterate over each key and retrieve its value from the environment
for key in "${keys[@]}"; do
value=$(printenv "$key")
if [[ -n "$value" ]]; then
bindings+="--binding ${key}=${value} "
fi
done < .env.local
done

# Trim any trailing whitespace
bindings=$(echo $bindings | sed 's/[[:space:]]*$//')

echo $bindings
Loading