Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
use log::LevelFilter;
use serde::Deserialize;
use std::{env, fs::read_to_string, path::Path};
use std::{
env,
fs::read_to_string,
net::{IpAddr, Ipv4Addr},
path::Path,
};

use crate::session::models::Port;

Expand Down Expand Up @@ -60,6 +65,7 @@ pub fn load_config() -> Option<Config> {
#[derive(Deserialize)]
#[serde(default)]
pub struct Config {
pub host: IpAddr,
pub port: Port,
pub qos: QosServerConfig,
pub reverse_proxy: bool,
Expand All @@ -73,6 +79,7 @@ pub struct Config {
impl Default for Config {
fn default() -> Self {
Self {
host: IpAddr::V4(Ipv4Addr::UNSPECIFIED),
port: 80,
qos: QosServerConfig::default(),
reverse_proxy: false,
Expand Down
7 changes: 2 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ use crate::{
use axum::{Extension, Server};
use config::load_config;
use log::{debug, error, info, LevelFilter};
use std::{
net::{Ipv4Addr, SocketAddr},
sync::Arc,
};
use std::{net::SocketAddr, sync::Arc};
use tokio::{join, signal};
use utils::logging;

Expand All @@ -37,7 +34,7 @@ async fn main() {
logging::setup(config.logging);

// Create the server socket address while the port is still available
let addr: SocketAddr = (Ipv4Addr::UNSPECIFIED, config.port).into();
let addr: SocketAddr = SocketAddr::new(config.host, config.port);

// Config data persisted to runtime
let runtime_config = RuntimeConfig {
Expand Down