From 47617f62846a2b6d7c73bed00d11deeed7b334a5 Mon Sep 17 00:00:00 2001 From: Christian Heusel Date: Mon, 12 Oct 2020 01:42:43 +0200 Subject: [PATCH] make more options accessible via env vars * correct the yaml synctax for the docker file * create an extra env file for the optional config stuff * modify the default config to respect the set env vars Signed-off-by: Christian Heusel --- config/config.default.php | 18 +++++++++--------- docker/deployment.env | 23 +++++++++++++++++++++++ docker/docker-compose.yml | 4 ++++ 3 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 docker/deployment.env diff --git a/config/config.default.php b/config/config.default.php index 11635c24..1110fca8 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -85,10 +85,10 @@ return [ // Redirect to this site after logging in or when pressing the top-left button // Must be one of news, meetings, user_shifts, angeltypes, user_questions - 'home_site' => 'news', + 'home_site' => env('HOME_SITE', 'news'), // Number of News shown on one site - 'display_news' => 10, + 'display_news' => env('DISPLAY_NEWS', 10), // Users are able to sign up 'registration_enabled' => (bool)env('REGISTRATION_ENABLED', true), @@ -97,7 +97,7 @@ return [ 'signup_requires_arrival' => false, // Whether newly-registered user should automatically be marked as arrived - 'autoarrive' => false, + 'autoarrive' => (bool)env('ANGEL_AUTOARRIVE', false), // Only allow shift signup this number of hours in advance // Setting this to 0 disables the feature @@ -115,22 +115,22 @@ return [ 'password_algorithm' => PASSWORD_DEFAULT, // The minimum length for passwords - 'min_password_length' => 8, + 'min_password_length' => env('PASSWORD_MINIMUM_LENGTH', 8), // Whether the DECT field should be enabled - 'enable_dect' => true, + 'enable_dect' => (bool)env('REGISTRATION_ENABLE_DECT', true), // Enables prename and lastname - 'enable_user_name' => false, + 'enable_user_name' => (bool)env('REGISTRATION_ENABLE_USERNAME', false), // Enable displaying the pronoun fields - 'enable_pronoun' => false, + 'enable_pronoun' => (bool)env('REGISTRATION_ENABLE_DECT', false), // Enables the planned arrival/leave date - 'enable_planned_arrival' => true, + 'enable_planned_arrival' => (bool)env('REGISTRATION_ENABLE_PLANNED_ARRIVAL', true), // Enables the T-Shirt configuration on signup and profile - 'enable_tshirt_size' => true, + 'enable_tshirt_size' => (bool)env('REGISTRATION_ENABLE_TSHIRT', true), // Number of shifts to freeload until angel is locked for shift signup. 'max_freeloadable_shifts' => 2, diff --git a/docker/deployment.env b/docker/deployment.env new file mode 100644 index 00000000..4d933ca9 --- /dev/null +++ b/docker/deployment.env @@ -0,0 +1,23 @@ +# MAINTENANCE=false +# APP_NAME="Engelsystem" +# ENVIRONMENT= 'production' +# APP_URL=null +# FAQ_URL='https://events.ccc.de/congress/2013/wiki/Static:Volunteers' +# MAIL_DRIVER='mail' +# MAIL_FROM_ADDRESS='noreply@engelsystem.de' +# MAIL_FROM_NAME=Engelsystem +# MAIL_HOST='localhost' +# MAIL_PORT=587 +# THEME=1 +# HOME_SITE='news' +# DISPLAY_NEWS=10 +# REGISTRATION_ENABLED=true +# PASSWORD_MINIMUM_LENGTH=8 +# REGISTRATION_ENABLE_DECT=true +# REGISTRATION_ENABLE_USERNAME=false +# REGISTRATION_ENABLE_DECT=false +# REGISTRATION_ENABLE_PLANNED_ARRIVAL=true +# REGISTRATION_ENABLE_TSHIRT=true +# TIMEZONE='Europe/Berlin' +# DEFAULT_LOCALE='en_US' +# ADD_HEADERS=true diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index f7955ff2..4a7894bb 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,3 +1,4 @@ +--- version: "3.6" services: es_nginx: @@ -22,6 +23,9 @@ services: MYSQL_USER: engelsystem MYSQL_PASSWORD: engelsystem MYSQL_DATABASE: engelsystem + # some optional env vars and their defaults can be seen in the env file + # for exact information have a look at config/config.default.php + env_file: deployment.env networks: - database - fpm