feat: allow specifying host/port

This commit is contained in:
Anna 2021-08-20 02:49:59 -04:00
parent 999f27623a
commit 47abf311e1
2 changed files with 9 additions and 1 deletions

View File

@ -1,10 +1,12 @@
use serde::Deserialize;
use twitch_api2::twitch_oauth2::{ClientId, ClientSecret};
use std::net::IpAddr;
#[derive(Deserialize)]
pub struct UserConfig {
pub twitch: Twitch,
pub bot: Bot,
pub web: Web,
}
#[derive(Deserialize)]
@ -18,3 +20,9 @@ pub struct Twitch {
pub struct Bot {
pub access_token: String,
}
#[derive(Deserialize)]
pub struct Web {
pub address: IpAddr,
pub port: u16,
}

View File

@ -36,7 +36,7 @@ pub async fn start_web(state: Arc<State>) {
let routes = authed.or(unauthed).recover(handle_rejection);
warp::serve(routes)
.run(([0, 0, 0, 0], 8000))
.run((state.user_config.web.address, state.user_config.web.port))
.await;
}