32 lines
716 B
Bash
32 lines
716 B
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
export PYTHONUNBUFFERED=1
|
|
|
|
STORE_PATH="/data/future_store"
|
|
LOG_LEVEL="info"
|
|
if [ -f /data/options.json ]; then
|
|
eval "$(python - <<'PY'
|
|
import json
|
|
import shlex
|
|
|
|
with open("/data/options.json", encoding="utf-8") as stream:
|
|
options = json.load(stream)
|
|
for name, env_name in {
|
|
"store_path": "STORE_PATH",
|
|
"log_level": "LOG_LEVEL",
|
|
}.items():
|
|
if name in options:
|
|
print(f"{env_name}={shlex.quote(str(options[name]))}")
|
|
PY
|
|
)"
|
|
fi
|
|
|
|
export SILLYHOME_FUTURE_STORE="$STORE_PATH"
|
|
mkdir -p "$SILLYHOME_FUTURE_STORE"
|
|
chown -R sillyhome:sillyhome "$SILLYHOME_FUTURE_STORE"
|
|
|
|
exec su -s /bin/sh sillyhome -c \
|
|
"uvicorn app.main:app --host 0.0.0.0 --port 8099 --log-level ${LOG_LEVEL}"
|
|
|