X-Git-Url: https://git.p6c8.net/jirafeau_project.git/blobdiff_plain/4823b32b6ce68f7a6a0949c225c808da4979506f..b33335fdd70b6d414a7d609e2f62a499b50c872f:/docker/docker_config.php?ds=sidebyside diff --git a/docker/docker_config.php b/docker/docker_config.php index 8c63134..140149e 100644 --- a/docker/docker_config.php +++ b/docker/docker_config.php @@ -1,7 +1,9 @@ + * Copyright (C) 2008 Julien "axolotl" BERNARD + * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2024 Jirafeau project (see AUTHORS.md) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -89,6 +91,28 @@ function env_2_cfg_string_array(&$cfg, $config_name) return true; } +function env_2_cfg_string_array_key_value(&$cfg, $config_name) +{ + $env_name = strtoupper($config_name); + $env_string = getenv($env_name); + if ($env_string === false) { + return; + } + $result = json_decode($env_string, true); + if (json_last_error() === JSON_ERROR_NONE) { + // JSON is valid + $c = count($result); + echo ("setting $config_name array with $c value(s)n\n"); + } else { + echo ("ERROR - invalid json for environment key $config_name \n"); + } + + $cfg[$config_name] = $result; + return true; +} + + + function setup_admin_password(&$cfg) { if (strlen($cfg['admin_password']) > 0) { @@ -161,19 +185,25 @@ function run_setup(&$cfg) setup_webroot($cfg); env_2_cfg_string($cfg, 'file_hash'); env_2_cfg_bool($cfg, 'preview'); - env_2_cfg_bool($cfg, 'title'); + env_2_cfg_string($cfg, 'title', false); env_2_cfg_string($cfg, 'organisation'); + env_2_cfg_string($cfg, 'lang'); env_2_cfg_string($cfg, 'contactperson'); env_2_cfg_string($cfg, 'style'); env_2_cfg_string($cfg, 'availability_default'); + env_2_cfg_string($cfg, 'dark_style'); env_2_cfg_bool($cfg, 'one_time_download'); + env_2_cfg_bool($cfg, 'one_time_download_preselected'); env_2_cfg_bool($cfg, 'enable_crypt'); env_2_cfg_bool($cfg, 'debug'); env_2_cfg_int($cfg, 'maximal_upload_size'); env_2_cfg_string_array($cfg, 'upload_password'); env_2_cfg_string_array($cfg, 'upload_ip'); + env_2_cfg_string_array($cfg, 'admin_ip'); env_2_cfg_string_array($cfg, 'upload_ip_nopassword'); env_2_cfg_string_array($cfg, 'proxy_ip'); + // this is a key value based value + env_2_cfg_string_array_key_value($cfg, 'availabilities'); env_2_cfg_bool($cfg, 'store_uploader_ip'); env_2_cfg_string($cfg, 'download_password_requirement'); env_2_cfg_int($cfg, 'download_password_gen_len');