From 74db5b8b61ec0ed61ed11332dd6d69c5c17e53be Mon Sep 17 00:00:00 2001 From: Kevin Whitaker Date: Tue, 6 Jan 2026 14:36:50 -0500 Subject: [PATCH] Put env vars use can update into separate file that is built from a template. --- CloudronManifest.json | 4 +++- Dockerfile | 1 + env.sh.template | 13 +++++++++++++ start.sh | 27 +++++++++++++++++++++------ 4 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 env.sh.template diff --git a/CloudronManifest.json b/CloudronManifest.json index 1999095..a00008d 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -1,6 +1,7 @@ { "title": "Romm", "version": "0.1.0", + "upstreamVersion":"4.5.0", "author":"Kevin Whitaker ", "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." } diff --git a/Dockerfile b/Dockerfile index b9510a8..01066ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ] diff --git a/env.sh.template b/env.sh.template new file mode 100644 index 0000000..a926bec --- /dev/null +++ b/env.sh.template @@ -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 diff --git a/start.sh b/start.sh index 067ff75..193b340 100755 --- a/start.sh +++ b/start.sh @@ -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