0
0
Fork 0
mirror of https://git.verdigado.com/NB-Public/simple-wkd.git synced 2024-10-30 05:05:52 +01:00

Add bind_host setting

This commit is contained in:
Delta1925 2023-04-16 19:08:46 +02:00
parent 192bd9675d
commit d4f4a35a65
No known key found for this signature in database
GPG key ID: 1C21ACE44193CB25
6 changed files with 8 additions and 2797 deletions

3
.gitignore vendored
View file

@ -1 +1,4 @@
/target
/data
/logs
config.toml config.toml

2770
backend/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,24 +0,0 @@
[package]
name = "simple-wkd"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-files = "0.6.2"
actix-web = "4.3.1"
chrono = "0.4.24"
flexi_logger = "0.25.3"
lettre = "0.10.4"
log = "0.4.17"
once_cell = "1.17.1"
rand = "0.8.5"
sequoia-net = "0.27.0"
sequoia-openpgp = { version = "1.14.0", default-features = false, features = ["crypto-openssl"] }
serde = { version = "1.0.160", features = ["derive"] }
serde_json = "1.0.96"
thiserror = "1.0.40"
tokio = { version = "1.27.0", features = ["time"] }
toml = "0.7.3"
url = { version = "2.3.1", features = ["serde"] }

View file

@ -61,8 +61,8 @@ async fn main() -> std::io::Result<()> {
} }
}); });
info!( info!(
"Running server on http://localhost:{} (External URL: {})", "Running server on http://{}:{} (External URL: {})",
SETTINGS.port, SETTINGS.external_url SETTINGS.bind_host, SETTINGS.port, SETTINGS.external_url
); );
HttpServer::new(|| { HttpServer::new(|| {
App::new() App::new()
@ -75,7 +75,7 @@ async fn main() -> std::io::Result<()> {
) )
.route("/{filename:.*}", web::get().to(index)) .route("/{filename:.*}", web::get().to(index))
}) })
.bind(("127.0.0.1", SETTINGS.port))? .bind((SETTINGS.bind_host.to_string(), SETTINGS.port))?
.run() .run()
.await .await
} }

View file

@ -14,6 +14,7 @@ pub struct Settings {
pub cleanup_interval: u64, pub cleanup_interval: u64,
pub allowed_domains: Vec<String>, pub allowed_domains: Vec<String>,
pub port: u16, pub port: u16,
pub bind_host: String,
pub external_url: Url, pub external_url: Url,
pub mail_settings: MailSettings, pub mail_settings: MailSettings,
} }

View file

@ -3,6 +3,7 @@ max_age = 900
cleanup_interval = 21600 cleanup_interval = 21600
allowed_domains = ["example.org", "example.com"] allowed_domains = ["example.org", "example.com"]
port = 8080 port = 8080
bind_host = "0.0.0.0"
external_url = "http://localhost:8080" external_url = "http://localhost:8080"
[mail_settings] [mail_settings]