From 844098aac3b04a07a0c75743717b8d15816fbc6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 31 Aug 2024 16:23:42 +0200 Subject: [PATCH 1/2] cleaning --- conf/.env | 4 ++++ conf/systemd.service | 4 ++-- scripts/install | 10 ++++++++++ scripts/upgrade | 12 +++++++++++- 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 conf/.env diff --git a/conf/.env b/conf/.env new file mode 100644 index 0000000..23c6c3f --- /dev/null +++ b/conf/.env @@ -0,0 +1,4 @@ +SHIORI_HTTP_PORT=__PORT__ +SHIORI_HTTP_ROOT_PATH=__PATH__ +SHIORI_DIR=__DATA_DIR__" +SHIORI_HTTP_SECRET_KEY=__KEY__" \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index 1141906..0d92eb2 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,10 +7,10 @@ After=network-online.target Type=simple User=__APP__ Group=__APP__ +EnvironmentFile="__INSTALL_DIR__/.env" WorkingDirectory=__INSTALL_DIR__/ -ExecStart=__INSTALL_DIR__/shiori server --port __PORT__ --webroot __PATH__ +ExecStart=__INSTALL_DIR__/shiori server Restart=always -Environment="SHIORI_DIR=__DATA_DIR__" [Install] WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index 8730de9..fbdf13f 100755 --- a/scripts/install +++ b/scripts/install @@ -12,6 +12,16 @@ ynh_setup_source --dest_dir="$install_dir" chmod +x "$install_dir/shiori" +#================================================= +# APP INITIAL CONFIGURATION +#================================================= +ynh_script_progression "Adding $app's configuration files..." + +ynh_add_config --template=".env" --destination="$install_dir/.env" + +chmod 400 "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" + #================================================= # SYSTEM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a0fe5d0..c847a80 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,10 +15,20 @@ ynh_systemctl --service=$app --action="stop" --log_path="systemd" #================================================= ynh_script_progression "Upgrading source files..." -ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir" --keep=".env" chmod +x "$install_dir/shiori" +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating $app's configuration files..." --weight=1 + +ynh_add_config --template=".env" --destination="$install_dir/.env" + +chmod 400 "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" + #================================================= # MIGRATE AND UPGRADE #================================================= From d94b94fbbd7cd3c9444b5492fb1d2221748a3a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 1 Sep 2024 13:50:32 +0200 Subject: [PATCH 2/2] Update tests.toml --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index 8131bc1..a94531f 100644 --- a/tests.toml +++ b/tests.toml @@ -12,4 +12,4 @@ test_format = 1.0 # Commits to test upgrade from # ------------------------------- - test_upgrade_from.787885e7.name = "Upgrade from 1.5.4" \ No newline at end of file + #test_upgrade_from.787885e7.name = "Upgrade from 1.5.4" \ No newline at end of file