From ce8d5b0eb993dfeb00c83edc90385cf78327d9f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 27 May 2024 14:55:21 +0200 Subject: [PATCH] use data dir for config --- conf/systemd.service | 2 +- scripts/install | 3 +-- scripts/upgrade | 13 +++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 0b83c64..92ddaf0 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__YNH_NODE__ server/cli.js start --config __INSTALL_DIR__/config.json +ExecStart=__YNH_NODE__ server/cli.js start --config __DATA_DIR__/config.json # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/scripts/install b/scripts/install index d21b61f..95477f7 100644 --- a/scripts/install +++ b/scripts/install @@ -68,8 +68,7 @@ ynh_script_progression --message="Installing app dependencies and creating admin pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install dependencies - #ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn build + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH ./server/cli.js users create $mail $password admin --config ./config.json popd diff --git a/scripts/upgrade b/scripts/upgrade index 384ffdd..480c1f3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,7 +22,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --keep="config.json" +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 chown -R $app:www-data "$install_dir" @@ -53,12 +53,12 @@ yunohost service add $app --description="Federated shared agenda for local commu #================================================= # UPDATE A CONFIG FILE #================================================= -#ynh_script_progression --message="Updating a configuration file..." --weight=1 +ynh_script_progression --message="Updating a configuration file..." --weight=1 -#ynh_add_config --template="config.json" --destination="$install_dir/config.json" +ynh_add_config --template="config.json" --destination="$data_dir/config.json" -#chmod 400 "$install_dir/config.json" -#chown $app:$app "$install_dir/config.json" +chmod 400 "$data_dir/config.json" +chown $app:$app "$data_dir/config.json" #================================================= # CONFIGURE THE APP @@ -67,7 +67,8 @@ ynh_script_progression --message="Updating app dependencies..." --weight=15 pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install/upgrade dependencies + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH ./server/cli.js users create $mail $password admin --config $data_dir/config.json popd #=================================================