diff --git a/Cargo.lock b/Cargo.lock index 2a9b8ee..ad5fb05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2189,7 +2189,7 @@ checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "reminder-rs" -version = "1.6.10" +version = "1.6.10-4" dependencies = [ "base64", "chrono", diff --git a/Cargo.toml b/Cargo.toml index b41fe3c..6cec92e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,8 +41,9 @@ maintainer-scripts = "debian" assets = [ ["target/release/reminder-rs", "usr/bin/reminder-rs", "755"], ["conf/default.env", "etc/reminder-rs/default.env", "600"], - ["web/static/**/*", "var/www/reminder-rs/static", "755"], - ["web/templates/**/*", "var/www/reminder-rs/templates", "755"], + ["conf/Rocket.toml", "etc/reminder-rs/Rocket.toml", "600"], + ["web/static/**/*", "lib/reminder-rs/static", "755"], + ["web/templates/**/*", "lib/reminder-rs/templates", "755"], # ["nginx/reminder-rs", "etc/nginx/sites-available/reminder-rs", "755"] ] diff --git a/conf/Rocket.toml b/conf/Rocket.toml new file mode 100644 index 0000000..5fb0fb2 --- /dev/null +++ b/conf/Rocket.toml @@ -0,0 +1,8 @@ +[default] +address = "127.0.0.1" +port = 18920 +template_dir = "/lib/reminder-rs/templates" +limits = { json = "10MiB" } + +[release] +secret_key = "release" diff --git a/debian/postinst b/debian/postinst index 0c2d89f..851559d 100644 --- a/debian/postinst +++ b/debian/postinst @@ -4,7 +4,8 @@ set -e id -u reminder &>/dev/null || useradd -r -M reminder -if [ ! -f /etc/reminder-rs/config.env ]; then +if [ ! -f '/etc/reminder-rs/config.env' ]; then + echo "Copying configuration file..." cp /etc/reminder-rs/default.env /etc/reminder-rs/config.env fi diff --git a/debian/postrm b/debian/postrm deleted file mode 100644 index dedab7e..0000000 --- a/debian/postrm +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -id -u reminder &>/dev/null || userdel reminder - -if [ -f /etc/reminder-rs/config.env ]; then - rm /etc/reminder-rs/config.env -fi - -#DEBHELPER# diff --git a/systemd/reminder-rs.service b/systemd/reminder-rs.service index ab99307..86ab1dd 100644 --- a/systemd/reminder-rs.service +++ b/systemd/reminder-rs.service @@ -5,6 +5,7 @@ Description=Reminder Bot User=reminder Type=simple ExecStart=/usr/bin/reminder-rs +WorkingDirectory=/lib/reminder-rs Restart=always RestartSec=4 # Environment="RUST_LOG=warn,reminder_rs=info,postman=info" diff --git a/web/src/lib.rs b/web/src/lib.rs index 92b45f6..7a11b12 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -105,7 +105,7 @@ pub async fn initialize( .manage(reqwest_client) .manage(serenity_context) .manage(db_pool) - .mount("/static", FileServer::from(concat!(env!("CARGO_MANIFEST_DIR"), "/static"))) + .mount("/static", FileServer::from("/lib/reminder-rs/static")) .mount( "/", routes![