From e9b71d63df40d766a19c6d287e21c6ae67930e95 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 17 Jul 2025 14:32:11 +0000 Subject: [PATCH] Revert 'delete' [nobuild] --- .../etc/cont-init.d/10-generate-config.sh | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 ente/rootfs/etc/cont-init.d/10-generate-config.sh diff --git a/ente/rootfs/etc/cont-init.d/10-generate-config.sh b/ente/rootfs/etc/cont-init.d/10-generate-config.sh new file mode 100755 index 000000000..ff9d0b894 --- /dev/null +++ b/ente/rootfs/etc/cont-init.d/10-generate-config.sh @@ -0,0 +1,77 @@ +#!/usr/bin/with-contenv bashio +# Generate museum.yaml (first boot) from add-on options +set -euo pipefail + +CFG=/config/museum.yaml + +if bashio::fs.file_exists "$CFG"; then + bashio::log.info "Using existing $CFG" + exit 0 +fi + +bashio::log.info "Generating $CFG" + +# --- options --- +USE_EXTERNAL_DB=$(bashio::config.true 'USE_EXTERNAL_DB' && echo true || echo false) + +DB_HOST="localhost" +DB_PORT=5432 +DB_USER="$(bashio::config 'DB_USERNAME')" +DB_PASS="$(bashio::config 'DB_PASSWORD')" +DB_NAME="$(bashio::config 'DB_DATABASE_NAME')" + +if ${USE_EXTERNAL_DB}; then + # override host/port for external DB (fall back if missing) + DB_HOST="$(bashio::config 'DB_HOSTNAME')" + DB_PORT="$(bashio::config 'DB_PORT')" + bashio::log.info "museum.yaml will point to external Postgres at ${DB_HOST}:${DB_PORT}" +else + bashio::log.info "museum.yaml will use internal Postgres." +fi + +MINIO_USER="$(bashio::config 'MINIO_ROOT_USER')" +MINIO_PASS="$(bashio::config 'MINIO_ROOT_PASSWORD')" + +# helpers +_random_b64() { head -c "$1" /dev/urandom | base64 | tr -d '\n'; } +_random_b64_url() { head -c "$1" /dev/urandom | base64 | tr '+/' '-_' | tr -d '\n'; } + +cat >"$CFG" <