Skip to content

Commit

Permalink
Updated entrypoint script for Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick committed Aug 7, 2024
1 parent 2871178 commit 56ff964
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions gai-backend/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
#!/bin/bash

set -e

file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"

if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}

file_env "ORCHID_GENAI_LLM_AUTH_KEY"
file_env "ORCHID_GENAI_RECIPIENT_KEY"
file_env "ORCHID_GENAI_LLM_URL"

while true
do
python server.py;
Expand Down

0 comments on commit 56ff964

Please sign in to comment.