From 828c4180cd1ddef4139f6bd3e0a83502ab278a62 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 31 Jan 2021 15:26:19 +0300 Subject: [PATCH] pull all set environment variables into app/etc --- .env-dist | 5 +++++ app/startup.sh | 10 ++++++---- app/updater.sh | 4 ++++ docker-compose.yml | 6 ++++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.env-dist b/.env-dist index a85523e..92e50a3 100644 --- a/.env-dist +++ b/.env-dist @@ -11,6 +11,11 @@ POSTGRES_PASSWORD=password # for more information. SELF_URL_PATH=http://localhost:8280/tt-rss +# You can customize other config.php defines by setting overrides here. +# See app/Dockerfile for complete list. +# PLUGINS=auth_remote,note +# CHECK_FOR_UPDATES="true" + # bind exposed port to 127.0.0.1 by default in case reverse proxy is used. # if you plan to run the container standalone and need origin port exposed # use next HTTP_PORT definition (or remove "127.0.0.1:"). diff --git a/app/startup.sh b/app/startup.sh index 39cbad6..26170b0 100755 --- a/app/startup.sh +++ b/app/startup.sh @@ -5,6 +5,12 @@ while ! pg_isready -h $DB_HOST -U $DB_USER; do sleep 3 done +# We don't need those here (HTTP_HOST would cause false SELF_URL_PATH check failures) +unset HTTP_PORT +unset HTTP_HOST + +env + if ! id app >/dev/null 2>&1; then addgroup -g $OWNER_GID app adduser -D -h /var/www/html -G app -u $OWNER_UID app @@ -66,10 +72,6 @@ elif ! $PSQL -c 'select * from ttrss_version'; then $PSQL < /var/www/html/tt-rss/schema/ttrss_schema_pgsql.sql fi -export SELF_URL_PATH=$(echo $SELF_URL_PATH | sed -e 's/[\/&]/\\&/g') - -env - if [ ! -s $DST_DIR/config.php ]; then cp /config.docker.php $DST_DIR/config.php diff --git a/app/updater.sh b/app/updater.sh index 2ddea88..7123a3c 100755 --- a/app/updater.sh +++ b/app/updater.sh @@ -1,5 +1,9 @@ #!/bin/sh -e +# We don't need those here (HTTP_HOST would cause false SELF_URL_PATH check failures) +unset HTTP_PORT +unset HTTP_HOST + # wait for the app container to delete .app_is_ready and perform rsync, etc. sleep 30 diff --git a/docker-compose.yml b/docker-compose.yml index a2d0b73..4430eb2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,11 +17,12 @@ services: context: ./app restart: unless-stopped + env_file: + - .env environment: - DB_NAME=${POSTGRES_USER} - DB_USER=${POSTGRES_USER} - DB_PASS=${POSTGRES_PASSWORD} - - SELF_URL_PATH=${SELF_URL_PATH} volumes: - app:/var/www/html - ./config.d:/opt/tt-rss/config.d:ro @@ -49,11 +50,12 @@ services: context: ./app restart: unless-stopped + env_file: + - .env environment: - DB_NAME=${POSTGRES_USER} - DB_USER=${POSTGRES_USER} - DB_PASS=${POSTGRES_PASSWORD} - - SELF_URL_PATH=${SELF_URL_PATH} volumes: - app:/var/www/html - ./config.d:/opt/tt-rss/config.d:ro