refactor(atward): Configure listen address
This appeases the flokli. Change-Id: Ib6a6c1a2cc8780e7944913d9204b42505b29fdc0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3093 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
a9902dadcf
commit
47d07e7b5f
2 changed files with 9 additions and 3 deletions
|
@ -7,6 +7,12 @@ in {
|
||||||
options.services.depot.atward = {
|
options.services.depot.atward = {
|
||||||
enable = lib.mkEnableOption description;
|
enable = lib.mkEnableOption description;
|
||||||
|
|
||||||
|
host = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "[::1]";
|
||||||
|
description = "Host on which atward should listen";
|
||||||
|
};
|
||||||
|
|
||||||
port = lib.mkOption {
|
port = lib.mkOption {
|
||||||
type = lib.types.int;
|
type = lib.types.int;
|
||||||
default = 28973;
|
default = 28973;
|
||||||
|
@ -25,7 +31,7 @@ in {
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.ATWARD_PORT = toString cfg.port;
|
environment.ATWARD_LISTEN_ADDRESS = "${cfg.host}:${toString cfg.port}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,8 @@ fn fallback() -> Response {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let queries = queries();
|
let queries = queries();
|
||||||
let port = std::env::var("ATWARD_PORT").unwrap_or("28973".to_string());
|
let address = std::env::var("ATWARD_LISTEN_ADDRESS")
|
||||||
let address = format!("0.0.0.0:{}", port);
|
.expect("ATWARD_LISTEN_ADDRESS environment variable must be set");
|
||||||
|
|
||||||
rouille::start_server(&address, move |request| {
|
rouille::start_server(&address, move |request| {
|
||||||
rouille::log(&request, std::io::stderr(), || {
|
rouille::log(&request, std::io::stderr(), || {
|
||||||
|
|
Loading…
Reference in a new issue