Put env vars use can update into separate file that is built from a template.

This commit is contained in:
2026-01-06 14:36:50 -05:00
parent 707aaeae15
commit 74db5b8b61
4 changed files with 38 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
{
"title": "Romm",
"version": "0.1.0",
"upstreamVersion":"4.5.0",
"author":"Kevin Whitaker <kevin@eyecreate.org>",
"description":"A beautiful, powerful, self-hosted rom manager and player.",
"healthCheckPath": "/api/heartbeat",
@@ -18,5 +19,6 @@
},
"website":"https://romm.app/",
"icon":"file://logo.png",
"manifestVersion": 2
"manifestVersion": 2,
"postInstallMessage":"Before setting up the first admin user, please check /app/data/env.sh for some API keys for metadata sources and fill in any you want to use. Put any ROMs in the /app/data/library/roms folder. Please see https://docs.romm.app/latest/Getting-Started/Folder-Structure/ for details on folder structure."
}

View File

@@ -83,6 +83,7 @@ RUN ln -sf /run/supervisord.log /var/log/supervisor/supervisord.log
ENV PATH="/app/code/.venv/bin:${PATH}"
COPY start.sh /app/pkg/
COPY env.sh.template /app/pkg/
CMD [ "/app/pkg/start.sh" ]

13
env.sh.template Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -eu
export IGDB_CLIENT_ID=
export IGDB_CLIENT_SECRET=
export MOBYGAMES_API_KEY=
export STEAMGRIDDB_API_KEY=
export RETROACHIEVEMENTS_API_KEY=
export SCREENSCRAPER_USER=
export SCREENSCRAPER_PASSWORD=
export HASHEOUS_API_ENABLED=true
export OIDC_ENABLED=true

View File

@@ -17,12 +17,6 @@ export DB_PORT=${CLOUDRON_POSTGRESQL_PORT}
export DB_NAME=${CLOUDRON_POSTGRESQL_DATABASE}
export DB_USER=${CLOUDRON_POSTGRESQL_USERNAME}
export DB_PASSWD=${CLOUDRON_POSTGRESQL_PASSWORD}
export ROMM_AUTH_SECRET_KEY=$(/usr/bin/openssl rand -hex 32)
export IGDB_CLIENT_ID=
export IGDB_CLIENT_SECRET=
export MOBYGAMES_API_KEY=
export STEAMGRIDDB_API_KEY=
export OIDC_ENABLED=true
export OIDC_PROVIDER=${CLOUDRON_OIDC_PROVIDER_NAME}
export OIDC_CLIENT_ID=${CLOUDRON_OIDC_CLIENT_ID}
export OIDC_CLIENT_SECRET=${CLOUDRON_OIDC_CLIENT_SECRET}
@@ -35,5 +29,26 @@ export XDG_CACHE_HOME=/tmp/cache
export REDIS_HOST=${CLOUDRON_REDIS_HOST}
export REDIS_PORT=${CLOUDRON_REDIS_PORT}
TEMPLATE_FILE="/app/pkg/env.sh.template"
ENV_FILE="/app/data/env.sh"
# Check if env.sh exists in /app/data
if [ -f "$ENV_FILE" ]; then
echo "env.sh already exists in $ENV_FILE"
else
# Copy the template to the target location
echo "Copying $TEMPLATE_FILE to $ENV_FILE"
cp "$TEMPLATE_FILE" "$ENV_FILE"
chmod +x "$ENV_FILE"
# Generate a new secret key using openssl
SECRET_KEY=$(openssl rand -hex 32 2>/dev/null)
echo "export ROMM_AUTH_SECRET_KEY=$SECRET_KEY" >> "$ENV_FILE"
echo "Successfully created $ENV_FILE from template"
fi
source /app/data/env.sh
echo "==> Starting supervisor"
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Romm