wip
This commit is contained in:
@@ -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:
|
||||
|
||||
17
src/main.rs
17
src/main.rs
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user