From 000b065e1e5d73e19a3be32d22ac38b8806de4b2 Mon Sep 17 00:00:00 2001 From: Tagadda <36127788+Tagadda@users.noreply.github.com> Date: Wed, 19 Jul 2023 23:41:16 +0200 Subject: [PATCH] wip --- conf/.env.production.sample | 2 +- config_panel.toml | 17 +++++++++++++++++ manifest.toml | 10 ++++++++++ scripts/upgrade | 6 ++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 config_panel.toml diff --git a/conf/.env.production.sample b/conf/.env.production.sample index 7005b5d..ea4535b 100644 --- a/conf/.env.production.sample +++ b/conf/.env.production.sample @@ -86,7 +86,7 @@ S3_ENABLED=false # IP and session retention # ----------------------- -LDAP_ENABLED=true +LDAP_ENABLED=__ENABLE_LDAP__ LDAP_HOST=localhost LDAP_PORT=389 LDAP_METHOD=start_tls diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..adc66a6 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,17 @@ +version = "1.0" + +[main] +services = ["__APP__-web","__APP__-sidekiq","__APP__-streaming"] + + [main.misc] + optional = false + + [main.misc.enable_ldap] + ask.en = "Enable LDAP integration" + ask.fr = "Activer l'intégration LDAP" + help.en = "If enabled, YunoHost users will be able to log in" + help.fr = "Une fois activé, les utilisateurs YunoHost pourront s'authentifier dans Mastodon" + type = "boolean" + bind = "LDAP_ENABLED:__INSTALL_DIR__/.env.production" + yes = "true" + no = "false" diff --git a/manifest.toml b/manifest.toml index 574ecd7..a52ac79 100644 --- a/manifest.toml +++ b/manifest.toml @@ -49,6 +49,16 @@ ram.runtime = "500M" [install.admin] type = "user" + [install.enable_ldap] + ask.en = "Enable LDAP integration" + ask.fr = "Activer l'intégration LDAP" + help.en = "If enabled, YunoHost users will be able to log in" + help.fr = "Une fois activé, les utilisateurs YunoHost pourront s'authentifier dans Mastodon" + type = "boolean" + default = true + yes = "true" + no = "false" + [resources] [resources.sources] [resources.sources.main] diff --git a/scripts/upgrade b/scripts/upgrade index 2dd3d32..a804408 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,6 +40,12 @@ if [[ -z "${service:-}" ]]; then ynh_app_setting_set --app="$app" --key=service --value="$service" fi +# If enable_ldap doesn't exist, create it +if [[ -z "$enable_ldap" ]]; then + enable_ldap="true" + ynh_app_settings_set --app=$app --key=enable_ldap --value=$enable_ldap +fi + # Remove previous added repository ynh_remove_extra_repo