Files
daily-counter/entrypoint.sh

28 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2026-03-31 19:09:37 +02:00
#!/usr/bin/env sh
2026-05-02 16:18:31 +02:00
set -e
2026-03-31 19:09:37 +02:00
STREAMLIT_SECRETS_LOCATION=".streamlit/secrets.toml"
2026-05-02 16:18:31 +02:00
touch $STREAMLIT_SECRETS_LOCATION
2026-04-25 10:38:21 +02:00
SQLITE_DATABASE="/data/daily-counter.db"
SQLITE_DATABASE_URL="sqlite://$SQLITE_DATABASE"
export DATABASE_URL="$SQLITE_DATABASE_URL"
echo "INFO [entrypoint] Using SQLite database at $SQLITE_DATABASE"
2026-03-31 19:09:37 +02:00
if [ "$OIDC_ENABLED" = "true" ]; then
2026-04-25 10:38:21 +02:00
echo "INFO [entrypoint] OIDC configuration detected. Configuring authentication..."
2026-03-31 19:09:37 +02:00
toml add_section --toml-path=$STREAMLIT_SECRETS_LOCATION 'auth'
toml set --toml-path=$STREAMLIT_SECRETS_LOCATION 'auth.redirect_uri' "$OIDC_PUBLIC_URL/oauth2callback"
toml set --toml-path=$STREAMLIT_SECRETS_LOCATION 'auth.cookie_secret' "$OIDC_COOKIE_SECRET"
toml set --toml-path=$STREAMLIT_SECRETS_LOCATION 'auth.client_id' "$OIDC_CLIENT_ID"
toml set --toml-path=$STREAMLIT_SECRETS_LOCATION 'auth.client_secret' "$OIDC_CLIENT_SECRET"
toml set --toml-path=$STREAMLIT_SECRETS_LOCATION 'auth.server_metadata_url' "$OIDC_METADATA_URL"
else
echo "INFO [entrypoint] No OIDC configuration detected."
fi
echo "INFO [entrypoint] Running database migrations..."
alembic upgrade head
echo "INFO [entrypoint] Running application..."
streamlit run app