From 36e0d29e64f711ed170d431542cf62eeb42b96d7 Mon Sep 17 00:00:00 2001 From: Jerome Jutteau Date: Sun, 13 Dec 2020 21:08:34 +0100 Subject: [PATCH] [TASK] add structure for docker configuration For now only one option is available: FILE_HASH You can run Jirafeau's docker with -e FILE_HASH="random" to disable file hashing. ref #146 Signed-off-by: Jerome Jutteau --- Dockerfile | 2 ++ docker/cleanup.sh | 2 +- docker/docker_config.php | 39 +++++++++++++++++++++++++++++++++++++++ docker/run.sh | 1 + 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 docker/docker_config.php diff --git a/Dockerfile b/Dockerfile index b710a85..dd75d58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ COPY .git .git RUN apk add git && \ git reset --hard && rm -rf docker .git .gitignore .gitlab-ci.yml CONTRIBUTING.md Dockerfile README.md && \ apk del git && \ + touch /www/lib/config.local.php && \ chown -R $USER_UID.$GROUP_UID /www && \ chmod o=,ug=rwX -R /www @@ -26,6 +27,7 @@ COPY docker/cleanup.sh /cleanup.sh RUN chmod o=,ug=rx /cleanup.sh COPY docker/run.sh /run.sh RUN chmod o=,ug=rx /run.sh +COPY docker/docker_config.php /docker_config.php # install lighttpd RUN apk add lighttpd php7-mcrypt && \ diff --git a/docker/cleanup.sh b/docker/cleanup.sh index 2d2697e..9254bae 100755 --- a/docker/cleanup.sh +++ b/docker/cleanup.sh @@ -6,4 +6,4 @@ do php /www/admin.php clean_async # wait 24 hours sleep 86400 -done \ No newline at end of file +done diff --git a/docker/docker_config.php b/docker/docker_config.php new file mode 100644 index 0000000..6500588 --- /dev/null +++ b/docker/docker_config.php @@ -0,0 +1,39 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +define('JIRAFEAU_ROOT', '/www/'); +define('JIRAFEAU_CFG', JIRAFEAU_ROOT . 'lib/config.local.php'); + +require(JIRAFEAU_ROOT . 'lib/settings.php'); +require(JIRAFEAU_ROOT . 'lib/functions.php'); +require(JIRAFEAU_ROOT . 'lib/lang.php'); + +function env_2_cfg_string($cfg, $config_name, $env_name) +{ + $r = getenv($env_name, true); + if ($r === false) { + return; + } + echo("setting up '" . $env_name . "' option\n"); + $cfg[$config_name] = $r; + jirafeau_export_cfg($cfg); +} + +// TODO: lots of other options to implement +env_2_cfg_string($cfg, 'file_hash', 'FILE_HASH'); +echo("docker config done\n"); diff --git a/docker/run.sh b/docker/run.sh index a57fa3b..8c9932e 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -1,4 +1,5 @@ #!/bin/sh -e /cleanup.sh & php-fpm -D +php /docker_config.php lighttpd -D -f /etc/lighttpd/lighttpd.conf -- 2.34.1