feat: allow specifying host/port
This commit is contained in:
parent
999f27623a
commit
47abf311e1
|
@ -1,10 +1,12 @@
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use twitch_api2::twitch_oauth2::{ClientId, ClientSecret};
|
use twitch_api2::twitch_oauth2::{ClientId, ClientSecret};
|
||||||
|
use std::net::IpAddr;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct UserConfig {
|
pub struct UserConfig {
|
||||||
pub twitch: Twitch,
|
pub twitch: Twitch,
|
||||||
pub bot: Bot,
|
pub bot: Bot,
|
||||||
|
pub web: Web,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -18,3 +20,9 @@ pub struct Twitch {
|
||||||
pub struct Bot {
|
pub struct Bot {
|
||||||
pub access_token: String,
|
pub access_token: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct Web {
|
||||||
|
pub address: IpAddr,
|
||||||
|
pub port: u16,
|
||||||
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub async fn start_web(state: Arc<State>) {
|
||||||
let routes = authed.or(unauthed).recover(handle_rejection);
|
let routes = authed.or(unauthed).recover(handle_rejection);
|
||||||
|
|
||||||
warp::serve(routes)
|
warp::serve(routes)
|
||||||
.run(([0, 0, 0, 0], 8000))
|
.run((state.user_config.web.address, state.user_config.web.port))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue