mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Default web_server.ip_address and port
Fall back to "0.0.0.0" and 3000 when these fields are omitted from the [web_server] section (api_key remains required). Update the sample TOML and README to reflect the new defaults; the Nix module already used them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0393378d24
commit
bee492b703
@@ -160,8 +160,8 @@ Options marked **Required** have no built-in default and must be set in your con
|
||||
|`database.path`|**Required**|Location of the system database. Must be `/db/oott.db` when using the Docker image.|
|
||||
|`networking.interface`|auto-detected|Network interface to use for scans. Optional — if not set, the first non-loopback connected interface is used automatically.|
|
||||
|`log.level`|`warn`|Log level to use (off, error, warn, info, debug, trace)|
|
||||
|`web_server.ip_address`|**Required**|Address the API and web UI bind to. Use `0.0.0.0` to bind all interfaces.|
|
||||
|`web_server.port`|**Required**|Port the API and web UI listen on.|
|
||||
|`web_server.ip_address`|`0.0.0.0`|Address the API and web UI bind to. Use `0.0.0.0` to bind all interfaces.|
|
||||
|`web_server.port`|`3000`|Port the API and web UI listen on.|
|
||||
|`web_server.api_key`|**Required**|API key the app must present to use the backend.|
|
||||
|`arp_scanner.enabled`|`true`|Whether to run the ARP scanner. The whole `[arp_scanner]` section is optional; omit it to use the defaults below. Set to `false` to turn it off.|
|
||||
|`arp_scanner.wait_between_scans`|`30m`|Time to wait between each network scan (you can express it in seconds, minutes, hours, etc. as a suffix - for example: 30s, 10m, 1h)|
|
||||
|
||||
@@ -14,6 +14,14 @@ fn default_log_level() -> String {
|
||||
"warn".to_string()
|
||||
}
|
||||
|
||||
fn default_ip_address() -> String {
|
||||
"0.0.0.0".to_string()
|
||||
}
|
||||
|
||||
fn default_port() -> u16 {
|
||||
3000
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub struct Database {
|
||||
pub path: String,
|
||||
@@ -143,7 +151,9 @@ pub struct Notifications {
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub struct WebServer {
|
||||
#[serde(default = "default_ip_address")]
|
||||
pub ip_address: String,
|
||||
#[serde(default = "default_port")]
|
||||
pub port: u16,
|
||||
pub api_key: String,
|
||||
}
|
||||
@@ -365,6 +375,29 @@ mod tests {
|
||||
assert_eq!(settings.log.level, "warn");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn web_server_address_and_port_default_when_fields_omitted() {
|
||||
// Keep the `[web_server]` section (api_key is required) but drop ip_address and port.
|
||||
const NO_ADDR_CONFIG: &str = r#"
|
||||
[database]
|
||||
path = "./oott.db"
|
||||
[networking]
|
||||
[log]
|
||||
level = "info"
|
||||
[notifications]
|
||||
method = "none"
|
||||
notify_when_not_seen_for = "1w"
|
||||
[notifications.pushover]
|
||||
token = ""
|
||||
user_key = ""
|
||||
[web_server]
|
||||
api_key = "test"
|
||||
"#;
|
||||
let settings = parse(NO_ADDR_CONFIG);
|
||||
assert_eq!(settings.web_server.ip_address, "0.0.0.0");
|
||||
assert_eq!(settings.web_server.port, 3000);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn device_events_dedup_window_defaults_when_section_omitted() {
|
||||
let settings = parse(BASE_CONFIG);
|
||||
|
||||
@@ -43,8 +43,8 @@ token="" # Your pushover token goes here, just copy&paste from their website aft
|
||||
user_key="" # User key goes here, this is the account wide code for pushover
|
||||
|
||||
[web_server]
|
||||
ip_address="0.0.0.0" # IP to bind the web server for the API and web UI to, use 0.0.0.0 to bind it to all interfaces
|
||||
port=3000 # Port to listen on
|
||||
ip_address="0.0.0.0" # IP to bind the web server for the API and web UI to, use 0.0.0.0 to bind it to all interfaces. Defaults to "0.0.0.0" if omitted
|
||||
port=3000 # Port to listen on. Defaults to 3000 if omitted
|
||||
api_key="CHANGE_ME" # API Key to use the system's API, change this!
|
||||
|
||||
[retention]
|
||||
|
||||
Reference in New Issue
Block a user