diff --git a/libticker/src/config.rs b/libticker/src/config.rs index 8a828c1..fdc3c18 100644 --- a/libticker/src/config.rs +++ b/libticker/src/config.rs @@ -12,6 +12,7 @@ pub struct CalendarOptions { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Config { pub db_url: String, + pub http_bind: String, pub calendars: BTreeMap, pub weekdays: Vec, pub months: Vec, diff --git a/nixos-module.nix b/nixos-module.nix index 9359342..aeec337 100644 --- a/nixos-module.nix +++ b/nixos-module.nix @@ -19,6 +19,7 @@ let ]; upcoming_days = 28; passed_days = 7; + http_bind = "0.0.0.0:8400"; }; tickerConfig = defaultTickerConfig // cfg.config; configFile = pkgs.writeText "config.yaml" (lib.generators.toYAML {} tickerConfig); diff --git a/ticker-serve/src/main.rs b/ticker-serve/src/main.rs index 76ac592..bf07650 100644 --- a/ticker-serve/src/main.rs +++ b/ticker-serve/src/main.rs @@ -24,6 +24,7 @@ pub struct AppState { fn main() { let config = Config::read_yaml_file("config.yaml"); + let http_bind = config.http_bind.clone(); let db = PgConnection::establish(&config.db_url) .expect("DB"); @@ -46,6 +47,6 @@ fn main() { .build() ); }); - gotham::start("0.0.0.0:8400", router) + gotham::start(http_bind, router) .unwrap() }