diff options
-rw-r--r-- | ops/modules/atward.nix | 8 | ||||
-rw-r--r-- | web/atward/src/main.rs | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/ops/modules/atward.nix b/ops/modules/atward.nix index 672b85e87d32..354f9ebdd3cb 100644 --- a/ops/modules/atward.nix +++ b/ops/modules/atward.nix @@ -7,6 +7,12 @@ in { options.services.depot.atward = { enable = lib.mkEnableOption description; + host = lib.mkOption { + type = lib.types.str; + default = "[::1]"; + description = "Host on which atward should listen"; + }; + port = lib.mkOption { type = lib.types.int; default = 28973; @@ -25,7 +31,7 @@ in { Restart = "always"; }; - environment.ATWARD_PORT = toString cfg.port; + environment.ATWARD_LISTEN_ADDRESS = "${cfg.host}:${toString cfg.port}"; }; }; } diff --git a/web/atward/src/main.rs b/web/atward/src/main.rs index 08fa51272819..e412def4a969 100644 --- a/web/atward/src/main.rs +++ b/web/atward/src/main.rs @@ -58,8 +58,8 @@ fn fallback() -> Response { fn main() { let queries = queries(); - let port = std::env::var("ATWARD_PORT").unwrap_or("28973".to_string()); - let address = format!("0.0.0.0:{}", port); + let address = std::env::var("ATWARD_LISTEN_ADDRESS") + .expect("ATWARD_LISTEN_ADDRESS environment variable must be set"); rouille::start_server(&address, move |request| { rouille::log(&request, std::io::stderr(), || { |