From 0fdf0be4a647b05d7795a2a020b96736999407eb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 Jan 2022 16:12:55 +0100 Subject: [PATCH] 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