wip
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -17,7 +17,7 @@ pub static DATA_STORAGE: &str = "storage/";
|
||||
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())
|
||||
addr.parse().unwrap_or("127.0.0.1".to_string())
|
||||
}
|
||||
Err(_) => {
|
||||
println!("Binding to default address: 0.0.0.0");
|
||||
@@ -25,8 +25,14 @@ pub static BIND_ADDR: LazyLock<String> = LazyLock::new(|| match env::var("BIND_A
|
||||
}
|
||||
});
|
||||
pub static BIND_PORT: LazyLock<u16> = LazyLock::new(|| match env::var("BIND_PORT") {
|
||||
Ok(port_str) => port_str.parse().unwrap_or(8080),
|
||||
Err(_) => 8080,
|
||||
Ok(port_str) => {
|
||||
println!("Binding to port: {}", port_str);
|
||||
port_str.parse().unwrap_or(8080)
|
||||
}
|
||||
Err(_) => {
|
||||
println!("Binding to default port: 8080");
|
||||
8080
|
||||
}
|
||||
});
|
||||
|
||||
pub static STATIC_PAGES: LazyLock<Vec<String>> = LazyLock::new(|| {
|
||||
@@ -79,6 +85,7 @@ async fn main() -> std::io::Result<()> {
|
||||
let _ = fs::create_dir_all(LOG_DIR);
|
||||
|
||||
println!("Starting server at http://{}:{}/", *BIND_ADDR, *BIND_PORT);
|
||||
|
||||
tokio::spawn(async {
|
||||
let mut interval = tokio::time::interval(tokio::time::Duration::from_secs(60));
|
||||
loop {
|
||||
|
||||
Reference in New Issue
Block a user