From 80d7e5e8c7552fb702014f8caba27f04b5e634f7 Mon Sep 17 00:00:00 2001 From: aptalca Date: Sun, 7 Oct 2018 12:07:45 -0400 Subject: [PATCH] Symlink .env rather than copy --- README.md | 1 + readme-vars.yml | 1 + root/etc/cont-init.d/50-config | 12 ++++++------ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 04b5327..201351e 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,7 @@ This image now supports password protection through htpasswd. Run the following ## Versions +* **07.10.18:** - Symlink `.env` rather than copy. It now resides under `/config/www` * **30.09.18:** - Multi-arch image. Move `.env` to `/config`. * **05.09.18:** - Rebase to alpine linux 3.8. * **06.03.18:** - Use password protection if htpasswd is set. Existing users can delete their default site config at /config/nginx/site-confs/default and restart the container, a new default site config with htpasswd support will be created in its place diff --git a/readme-vars.yml b/readme-vars.yml index 173cb21..417ba9a 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -47,6 +47,7 @@ app_setup_block: | # changelog changelogs: + - { date: "07.10.18:", desc: "Symlink `.env` rather than copy. It now resides under `/config/www`" } - { date: "30.09.18:", desc: "Multi-arch image. Move `.env` to `/config`." } - { date: "05.09.18:", desc: "Rebase to alpine linux 3.8." } - { date: "06.03.18:", desc: "Use password protection if htpasswd is set. Existing users can delete their default site config at /config/nginx/site-confs/default and restart the container, a new default site config with htpasswd support will be created in its place" } diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 538fabd..4e41092 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -4,12 +4,17 @@ mkdir -p \ /config/www/{backgrounds,icons} +# copy .env if not exists +[[ ! -f /config/www/.env ]] && \ + cp /var/www/localhost/heimdall/.env /config/www/.env + # create symlinks symlinks=( \ /var/www/localhost/heimdall/storage/app/public/backgrounds \ /var/www/localhost/heimdall/storage/app/public/icons \ -/var/www/localhost/heimdall/database/app.sqlite ) +/var/www/localhost/heimdall/database/app.sqlite \ +/var/www/localhost/heimdall/.env ) for i in "${symlinks[@]}" do @@ -17,11 +22,6 @@ do [[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i" done -# sync .env -[[ ! -f /config/.env ]] && \ - cp /var/www/localhost/heimdall/.env /config/.env -cp /config/.env /var/www/localhost/heimdall/.env - # permissions chown -R abc:abc \ /config \