diff --git a/docker/Dockerfile b/docker/Dockerfile index 546ab0a1..9c27d2b7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,8 +20,7 @@ RUN addgroup -g 1000 -S invidious && \ adduser -u 1000 -S invidious -G invidious COPY ./assets/ ./assets/ COPY --chown=invidious ./config/config.* ./config/ -RUN mv -n config/config.example.yml config/config.yml -RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: postgres/' config/config.yml + COPY ./config/sql/ ./config/sql/ COPY ./locales/ ./locales/ COPY --from=builder /invidious/invidious . diff --git a/docker/startup b/docker/startup index c25872ce..0d25f88f 100644 --- a/docker/startup +++ b/docker/startup @@ -1,23 +1,29 @@ #!/bin/sh -echo "Configuring Invidious" +CONF_FILE="/invidious/config/config.yml" -cat < /invidious/config/config.yml -channel_threads: $INVIDIOUS_CHANNEL_THREADS -check_tables: $INVIDIOUS_CHECK_TABLES -feed_threads: $INVIDIOUS_FEED_THREADS -db: - user: $POSTGRES_USER - password: $POSTGRES_PASS - host: $POSTGRES_HOST - port: $POSTGRES_PORT - dbname: $POSTGRES_DB -full_refresh: $INVIDIOUS_FULL_REFRESH -https_only: $INVIDIOUS_HTTPS_ONLY -domain: $INVIDIOUS_DOMAIN -registration_enabled: $INVIDIOUS_REGISTRATION_ENABLED -disable_proxy: $INVIDIOUS_DISABLE_PROXY +if [ -f "$CONF_FILE" ]; then + echo "Existing configuration found. Skipping environment variable based conifg..." +else + echo "Configuring Invidious" + + cat < /invidious/config/config.yml + channel_threads: $INVIDIOUS_CHANNEL_THREADS + check_tables: $INVIDIOUS_CHECK_TABLES + feed_threads: $INVIDIOUS_FEED_THREADS + db: + user: $POSTGRES_USER + password: $POSTGRES_PASS + host: $POSTGRES_HOST + port: $POSTGRES_PORT + dbname: $POSTGRES_DB + full_refresh: $INVIDIOUS_FULL_REFRESH + https_only: $INVIDIOUS_HTTPS_ONLY + domain: $INVIDIOUS_DOMAIN + registration_enabled: $INVIDIOUS_REGISTRATION_ENABLED + disable_proxy: $INVIDIOUS_DISABLE_PROXY EOF +fi # kemal is the hardcoded postgres username for i in /invidious/config/sql/*.sql; do sed -i s/kemal/$POSTGRES_USER/g $i; done