From 0fdf0be4a647b05d7795a2a020b96736999407eb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 Jan 2022 16:12:55 +0100 Subject: [PATCH 1/5] Fix --- conf/config.yml | 2 +- config_panel.toml | 15 +++++++++++++++ scripts/install | 6 +++++- scripts/upgrade | 7 +++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 config_panel.toml diff --git a/conf/config.yml b/conf/config.yml index 4ea9c3c..d8a061d 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -16,7 +16,7 @@ service: # Enable the caldav endpoint, see the docs for more details enablecaldav: true # Set the motd message, available from the /info endpoint - motd: "" + motd: __SET_MOTD__ # Enable sharing of lists via a link enablelinksharing: true # Whether to let new users registering themselves or not diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..bbce81f --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,15 @@ +version = "1.0" + +[main] +name = "Vikunja configuration" +services = ["__APP__"] + + [main.config] + name = "Configuration Options" + + [main.config.set_motd] + ask = "Set MOTD" + type = "string" + help = "Set the motd message, available from the /info endpoint" + bind = "motd:/etc/vikunja/config.yml" + diff --git a/scripts/install b/scripts/install index e3e4662..cd0b715 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,8 @@ secret=$(ynh_string_random --length=32) app=$YNH_APP_INSTANCE_NAME +set_motd="" + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -37,7 +39,6 @@ final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" mkdir -p "/etc/vikunja" -#touch "/etc/vikunja/config.yml" # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -49,6 +50,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd #================================================= # STANDARD MODIFICATIONS @@ -128,6 +130,8 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 redis_db=$(ynh_redis_get_free_db) ynh_add_config --template="../conf/config.yml" --destination="/etc/vikunja/config.yml" +chmod 400 "/etc/vikunja/config.yml" +chown $app:$app "/etc/vikunja/config.yml" #================================================= # SETUP SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 580f2c8..2cae635 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -26,6 +26,8 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) timezone="$(cat /etc/timezone)" secret=$(ynh_string_random --length=32) +set_motd=$(ynh_app_setting_get --app=$app --key=set_motd) + #================================================= # CHECK VERSION #================================================= @@ -37,6 +39,11 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +if [ -z "$set_motd" ]; then + set_motd="" + ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all From c3bb43b48274c27390b43791d122eea4313962c5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 Jan 2022 16:14:50 +0100 Subject: [PATCH 2/5] Update config.yml --- conf/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/config.yml b/conf/config.yml index d8a061d..d499580 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -98,17 +98,17 @@ cors: mailer: # Whether to enable the mailer or not. If it is disabled, all users are enabled right away and password reset is not possible. - enabled: false + enabled: true # SMTP Host - host: "" + host: "localhost" # SMTP Host port - port: 587 + port: 25 # SMTP username - username: "user" + username: "vikunja" # SMTP password password: "" # Wether to skip verification of the tls certificate on the server - skiptlsverify: false + skiptlsverify: true # The default from address when sending emails fromemail: "mail@vikunja" # The length of the mail queue. From 5bb9bac4e5a4712b908275d6ea28885e68bf8fd6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 Jan 2022 17:00:45 +0100 Subject: [PATCH 3/5] enable_registration --- conf/config.yml | 2 +- config_panel.toml | 8 ++++++++ scripts/install | 2 ++ scripts/upgrade | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/conf/config.yml b/conf/config.yml index d499580..1fa518c 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -20,7 +20,7 @@ service: # Enable sharing of lists via a link enablelinksharing: true # Whether to let new users registering themselves or not - enableregistration: true + enableregistration: __ENABLE_REGISTRATION__ # Whether to enable task attachments or not enabletaskattachments: true # The time zone all timestamps are in. Please note that time zones have to use [the official tz database names](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). UTC or GMT offsets won't work. diff --git a/config_panel.toml b/config_panel.toml index bbce81f..dfccafb 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,3 +13,11 @@ services = ["__APP__"] help = "Set the motd message, available from the /info endpoint" bind = "motd:/etc/vikunja/config.yml" + [main.config.enable_registration] + ask = "Enable registration" + type = "boolean" + yes = "true" + no = "false" + help = "Whether to let new users registering themselves or not" + bind = "enableregistration:/etc/vikunja/config.yml" + diff --git a/scripts/install b/scripts/install index cd0b715..71f5866 100644 --- a/scripts/install +++ b/scripts/install @@ -29,6 +29,7 @@ secret=$(ynh_string_random --length=32) app=$YNH_APP_INSTANCE_NAME set_motd="" +enable_registration="true" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -51,6 +52,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd +ynh_app_setting_set --app=$app --key=enable_registration --value=$enable_registration #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index 2cae635..9d1a724 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,6 +27,7 @@ timezone="$(cat /etc/timezone)" secret=$(ynh_string_random --length=32) set_motd=$(ynh_app_setting_get --app=$app --key=set_motd) +enable_registration=$(ynh_app_setting_get --app=$app --key=enable_registration) #================================================= # CHECK VERSION @@ -44,6 +45,11 @@ if [ -z "$set_motd" ]; then ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd fi +if [ -z "$enable_registration" ]; then + enable_registration="true" + ynh_app_setting_set --app=$app --key=enable_registration --value=$enable_registration +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all From 0ecf632f2db2625baefee0af680f8eb8dd3bdef2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 Jan 2022 17:15:03 +0100 Subject: [PATCH 4/5] Update config.yml --- conf/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/config.yml b/conf/config.yml index 1fa518c..7af90b7 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -98,7 +98,7 @@ cors: mailer: # Whether to enable the mailer or not. If it is disabled, all users are enabled right away and password reset is not possible. - enabled: true + enabled: false # SMTP Host host: "localhost" # SMTP Host port From db91b938ca162f5137c5386dafc9a30d9dfa2248 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 Jan 2022 17:15:58 +0100 Subject: [PATCH 5/5] Update config.yml --- conf/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/config.yml b/conf/config.yml index 7af90b7..384ad0f 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -100,15 +100,15 @@ mailer: # Whether to enable the mailer or not. If it is disabled, all users are enabled right away and password reset is not possible. enabled: false # SMTP Host - host: "localhost" + host: "" # SMTP Host port - port: 25 + port: 587 # SMTP username - username: "vikunja" + username: "user" # SMTP password password: "" # Wether to skip verification of the tls certificate on the server - skiptlsverify: true + skiptlsverify: false # The default from address when sending emails fromemail: "mail@vikunja" # The length of the mail queue.