Add: Log message for config loading.

This commit is contained in:
ghost 2025-12-28 21:51:22 +01:00
parent 8fc5450dc0
commit 0382ba4f15

View File

@ -36,16 +36,15 @@ fn resolve_host_or_ip(label: &str, value: &str) -> Option<IpAddr> {
#[tokio::main] #[tokio::main]
async fn main() -> anyhow::Result<()> { async fn main() -> anyhow::Result<()> {
// Bootstrap configuration: prefer appsettings.json, otherwise rely on baked-in demo defaults. // Bootstrap configuration: prefer appsettings.json, otherwise rely on baked-in demo defaults.
let cfg = match Config::load_default() { let (cfg, cfg_source) = match Config::load_default() {
Ok(c) => { Ok(c) => (c, "appsettings.json".to_string()),
c
}
Err(e) => { Err(e) => {
eprintln!( eprintln!(
"no appsettings.json found or failed to load: {} — using defaults", "no appsettings.json found or failed to load: {} — using defaults",
e e
); );
// defaults // defaults
(
Config { Config {
server: niom_turn::config::ServerOptions { server: niom_turn::config::ServerOptions {
bind: "0.0.0.0:3478".to_string(), bind: "0.0.0.0:3478".to_string(),
@ -66,7 +65,9 @@ async fn main() -> anyhow::Result<()> {
relay: niom_turn::config::RelayOptions::default(), relay: niom_turn::config::RelayOptions::default(),
logging: niom_turn::config::LoggingOptions::default(), logging: niom_turn::config::LoggingOptions::default(),
limits: niom_turn::config::LimitsOptions::default(), limits: niom_turn::config::LimitsOptions::default(),
} },
"defaults".to_string(),
)
} }
}; };
@ -81,6 +82,13 @@ async fn main() -> anyhow::Result<()> {
let rate_limiters = Arc::new(RateLimiters::from_limits(&cfg.limits)); let rate_limiters = Arc::new(RateLimiters::from_limits(&cfg.limits));
info!("niom-turn starting"); info!("niom-turn starting");
info!("config source={} realm={} creds={} rest_secret={} tls_cert={}",
cfg_source,
cfg.auth.realm,
cfg.credentials.len(),
cfg.auth.rest_secret.is_some(),
cfg.server.tls_cert.is_some()
);
info!("logging.default_directive={}", log_directive); info!("logging.default_directive={}", log_directive);
let udp_bind = cfg let udp_bind = cfg