ticker-serve/index: make http_bind configurable
This commit is contained in:
parent
c2d8306861
commit
1a55ead24d
|
@ -12,6 +12,7 @@ pub struct CalendarOptions {
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub db_url: String,
|
pub db_url: String,
|
||||||
|
pub http_bind: String,
|
||||||
pub calendars: BTreeMap<String, CalendarOptions>,
|
pub calendars: BTreeMap<String, CalendarOptions>,
|
||||||
pub weekdays: Vec<String>,
|
pub weekdays: Vec<String>,
|
||||||
pub months: Vec<String>,
|
pub months: Vec<String>,
|
||||||
|
|
|
@ -19,6 +19,7 @@ let
|
||||||
];
|
];
|
||||||
upcoming_days = 28;
|
upcoming_days = 28;
|
||||||
passed_days = 7;
|
passed_days = 7;
|
||||||
|
http_bind = "0.0.0.0:8400";
|
||||||
};
|
};
|
||||||
tickerConfig = defaultTickerConfig // cfg.config;
|
tickerConfig = defaultTickerConfig // cfg.config;
|
||||||
configFile = pkgs.writeText "config.yaml" (lib.generators.toYAML {} tickerConfig);
|
configFile = pkgs.writeText "config.yaml" (lib.generators.toYAML {} tickerConfig);
|
||||||
|
|
|
@ -24,6 +24,7 @@ pub struct AppState {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let config = Config::read_yaml_file("config.yaml");
|
let config = Config::read_yaml_file("config.yaml");
|
||||||
|
let http_bind = config.http_bind.clone();
|
||||||
let db = PgConnection::establish(&config.db_url)
|
let db = PgConnection::establish(&config.db_url)
|
||||||
.expect("DB");
|
.expect("DB");
|
||||||
|
|
||||||
|
@ -46,6 +47,6 @@ fn main() {
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
gotham::start("0.0.0.0:8400", router)
|
gotham::start(http_bind, router)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue