This commit is contained in:
2026-01-06 17:35:17 +01:00
parent 37d17dc8b8
commit 28f2dc7787
2 changed files with 17 additions and 6 deletions

View File

@@ -18,9 +18,9 @@ services:
- "traefik.http.services.bhs.loadbalancer.server.port=80"
environment:
- TZ="Europe/Rome"
- BIND_ADDR="0.0.0.0"
- BIND_PORT="80"
- TZ=Europe/Rome
- BIND_ADDR=0.0.0.0
- BIND_PORT=80
tty: true
stdin_open: true
ports:

View File

@@ -14,9 +14,20 @@ pub static HTML_DIR: &str = "html/";
pub static LOG_DIR: &str = "logs/";
pub static DATA_STORAGE: &str = "storage/";
pub static BIND_ADDR: LazyLock<String> = LazyLock::new(|| env::var("BIND_ADDR").unwrap_or("127.0.0.1".into()));
pub static BIND_PORT: LazyLock<u16> =
LazyLock::new(|| env::var("BIND_PORT").ok().and_then(|s| s.parse().ok()).unwrap_or(8080));
pub static BIND_ADDR: LazyLock<String> = LazyLock::new(|| match env::var("BIND_ADDR") {
Ok(addr) => {
println!("Binding to address: {}", addr);
addr.parse().unwrap_or("0.0.0.0".to_string())
}
Err(_) => {
println!("Binding to default address: 0.0.0.0");
"0.0.0.0".to_string()
}
});
pub static BIND_PORT: LazyLock<u16> = LazyLock::new(|| match env::var("BIND_PORT") {
Ok(port_str) => port_str.parse().unwrap_or(8080),
Err(_) => 8080,
});
pub static STATIC_PAGES: LazyLock<Vec<String>> = LazyLock::new(|| {
fs::read_dir(HTML_DIR)