diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 0591614..5d90ec3 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -424,7 +424,7 @@ dependencies = [ [[package]] name = "cryptgeon" -version = "2.0.1" +version = "2.0.2" dependencies = [ "actix-files", "actix-web", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 551c1ba..60399af 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cryptgeon" -version = "2.0.1" +version = "2.0.2" authors = ["cupcakearmy "] edition = "2021" diff --git a/backend/src/client.rs b/backend/src/client.rs index 2131e1c..f89501f 100644 --- a/backend/src/client.rs +++ b/backend/src/client.rs @@ -1,14 +1,17 @@ use actix_files::{Files, NamedFile}; use actix_web::{web, Result}; +use crate::config; + pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( - Files::new("/", "./frontend/build") + Files::new("/", config::FRONTEND_PATH.to_string()) .index_file("index.html") .use_etag(true), ); } pub async fn index() -> Result { - Ok(NamedFile::open("./frontend/build/index.html")?) + let index = format!("{}{}", config::FRONTEND_PATH.to_string(), "/index.html"); + Ok(NamedFile::open(index)?) } diff --git a/backend/src/config.rs b/backend/src/config.rs index ff87c78..32a0cb3 100644 --- a/backend/src/config.rs +++ b/backend/src/config.rs @@ -1,10 +1,16 @@ use byte_unit::Byte; -// General +// Internal lazy_static! { pub static ref VERSION: String = option_env!("CARGO_PKG_VERSION") .unwrap_or("Unknown") .to_string(); + pub static ref FRONTEND_PATH: String = option_env!("FRONTEND_PATH") + .unwrap_or("../frontend/build") + .to_string(); + pub static ref LISTEN_ADDR: String = option_env!("LISTEN_ADDR") + .unwrap_or("0.0.0.0:5000") + .to_string(); } // CONFIG diff --git a/backend/src/main.rs b/backend/src/main.rs index 45939cd..122e67c 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -29,7 +29,7 @@ async fn main() -> std::io::Result<()> { .configure(client::init) .default_service(web::to(client::index)) }) - .bind("0.0.0.0:5000")? + .bind(config::LISTEN_ADDR.to_string())? .run() .await; }