Move Port Number to Config.toml

This commit is contained in:
Neshura 2023-09-12 20:34:53 +02:00
parent 2ac5931c79
commit 817f777059
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -40,6 +40,12 @@ macro_rules! api_base_3 {
#[derive(Serialize, Deserialize, Debug, Clone)]
pub(crate) struct ConfigToml {
auth: AuthenticationTokens,
port: PortConfig,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub(crate) struct PortConfig {
default: u16,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
@ -270,7 +276,7 @@ async fn main() -> Result<()> {
.config(swagger_config.clone()),
)
})
.bind((Ipv6Addr::UNSPECIFIED, 8080)).expect("Port or IP already occupied")
.bind((Ipv6Addr::UNSPECIFIED, config.port.default)).expect("Port or IP already occupied")
.run();
let server_thread = tokio::spawn(async {