CliProxyApiServer / entrypoint.sh
github-actions[bot]
sync huggingface deployment from Viciy2023/CLIProxyAPI@757f412a36d42bcd769c7008d4edf8ab528ada99
f938cda
raw
history blame contribute delete
868 Bytes
#!/bin/sh
set -eu
APP_HOME="${APP_HOME:-/opt/cli-proxy-api}"
DATA_DIR="${DATA_DIR:-/data}"
CONFIG_PATH="${CONFIG_PATH:-${DATA_DIR}/config.yaml}"
EXAMPLE_PATH="${APP_HOME}/config.example.yaml"
mkdir -p "${DATA_DIR}" "${DATA_DIR}/auths" "${DATA_DIR}/logs" "${DATA_DIR}/.cli-proxy-api"
export HOME="${DATA_DIR}"
export DEPLOY="${DEPLOY:-cloud}"
cd "${DATA_DIR}"
if [ ! -f "${DATA_DIR}/.env" ]; then
printf '%s\n' "warning: ${DATA_DIR}/.env not found, starting without extra environment variables" >&2
fi
if [ ! -f "${CONFIG_PATH}" ]; then
if [ ! -f "${EXAMPLE_PATH}" ]; then
printf '%s\n' "fatal: bundled config.example.yaml not found at ${EXAMPLE_PATH}" >&2
exit 1
fi
cp "${EXAMPLE_PATH}" "${CONFIG_PATH}"
printf '%s\n' "initialized ${CONFIG_PATH} from bundled config.example.yaml"
fi
exec "${APP_HOME}/cli-proxy-api" --config "${CONFIG_PATH}"