From dbc061f0b8b774960bb2a83613a5dd685578f073 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 21 Feb 2024 23:19:58 +0700 Subject: [PATCH] Update --- config_panel.toml | 50 +++++++++++++++++++++++------------------------ scripts/config | 16 +++++++++++++++ 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 5a64ef6..73bc1e9 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -2,32 +2,30 @@ version = "1.0" [main] name = "Moncycle.app configuration" - # [main.comptes] - # name = "comptes" + [main.comptes] + name = "comptes" - # [main.comptes.creation_compte] - # ask.en = "Enable account creation" - # ask.fr = "Permettre la création de nouveaux comptes" - # type = "select" - # choices = ["true", "false"] - # default = "true" - # help = "Don't disable account creation before creating one for yourself !" - # bind = "CREATION_COMPTE:__INSTALL_DIR__/config.php" - # - # [main.comptes.connexion_compte] - # ask.en = "Enable account connexion" - # ask.fr = "Permettre la connexion aux comptes" - # type = "select" - # choices = ["true", "false"] - # default = "true" - # bind = "CONNEXION_COMPTE:__INSTALL_DIR__/config.php" - - [main.export] - name = "export" + [main.comptes.creation_compte] + ask.en = "Enable account creation" + ask.fr = "Permettre la création de nouveaux comptes" + type = "select" + choices = ["true", "false"] + default = "true" + help = "Don't disable account creation before creating one for yourself !" - [main.export.csv_sep] - ask.en = "Separator for data export in csv format" - ask.fr = "Séparateur pour l'export des données au format csv" - type = "string" - default = ";" + [main.comptes.connexion_compte] + ask.en = "Enable account connexion" + ask.fr = "Permettre la connexion aux comptes" + type = "select" + choices = ["true", "false"] + default = "true" + + [main.export] + name = "export" + + [main.export.csv_sep] + ask.en = "Separator for data export in csv format" + ask.fr = "Séparateur pour l'export des données au format csv" + type = "string" + default = ";" \ No newline at end of file diff --git a/scripts/config b/scripts/config index 9fdde39..1bf8dd4 100644 --- a/scripts/config +++ b/scripts/config @@ -32,6 +32,22 @@ set__csv_sep(){ sed -i "s/define(\"CSV_SEP\",.*);/define(\"CSV_SEP\", \"$csv_sep\");/" "$install_dir/config.php" } +get__creation_compte(){ + grep -oPi 'define\("CREATION_COMPTE",[\s"]*\K[^\")]+' "$install_dir/config.php" +} + +set__creation_compte(){ + sed -i "s/define(\"CREATION_COMPTE\",.*);/define(\"CSV_SEP\", \"$creation_compte\");/" "$install_dir/config.php" +} + +get__connexion_compte(){ + grep -oPi 'define\("CONNEXION_COMPTE",[\s"]*\K[^\")]+' "$install_dir/config.php" +} + +set__connexion_compte(){ + sed -i "s/define(\"CONNEXION_COMPTE\",.*);/define(\"CSV_SEP\", \"$connexion_compte\");/" "$install_dir/config.php" +} + #================================================= # GENERIC FINALIZATION