From 0ddd75502d7c99cd6166ef6f1c0a2c5c6db22206 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sat, 8 Apr 2023 15:56:29 -0500 Subject: [PATCH] Reverted the default urls.sqlite location --- actix/src/main.rs | 8 ++++++-- compose.yaml | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/actix/src/main.rs b/actix/src/main.rs index c80c002..30d444b 100644 --- a/actix/src/main.rs +++ b/actix/src/main.rs @@ -107,7 +107,11 @@ async fn delete_link( async fn main() -> std::io::Result<()> { // Generate session key in runtime so that restarts invalidates older logins let secret_key = Key::generate(); - let db_location = env::var("db_url").unwrap_or("/opt/urls.sqlite".to_string()); + let db_location = env::var("db_url").unwrap_or("/urls.sqlite".to_string()); + let port = env::var("port") + .unwrap_or("4567".to_string()) + .parse::() + .expect("Supplied port is not an integer"); // Actually start the server HttpServer::new(move || { @@ -130,7 +134,7 @@ async fn main() -> std::io::Result<()> { .service(login) .default_service(Files::new("/", "./resources/").index_file("index.html")) }) - .bind(("0.0.0.0", 4567))? + .bind(("0.0.0.0", port))? .run() .await } diff --git a/compose.yaml b/compose.yaml index 118e222..32dc91c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -9,7 +9,7 @@ services: # Change if you want to mount the database somewhere else # In this case, you can get rid of the db volume below # and instead do a mount manually by specifying the location - # - db_url=/opt/urls.sqlite + # - db_url=/urls.sqlite # Change it in case you want to set the website name # displayed in front of the shorturls, defaults to # the hostname you're accessing it from @@ -17,7 +17,7 @@ services: - username=admin - password=$3CuReP4S$W0rD volumes: - - db:/opt/urls.sqlite + - db:/urls.sqlite networks: - proxy