layer4-proxy/src/main.rs

29 lines
650 B
Rust
Raw Normal View History

2021-10-21 08:43:59 +00:00
mod config;
2021-10-26 15:02:05 +00:00
mod plugins;
2021-10-21 08:43:59 +00:00
mod servers;
use crate::config::Config;
use crate::servers::Server;
2021-11-01 08:06:47 +00:00
use std::env;
2021-10-21 08:43:59 +00:00
use log::{debug, error};
fn main() {
2021-11-01 08:06:47 +00:00
let config_path = env::var("FOURTH_CONFIG").unwrap_or_else(|_| "/etc/fourth/config.yaml".to_string());
let config = match Config::new(&config_path) {
2021-10-21 08:43:59 +00:00
Ok(config) => config,
Err(e) => {
println!("Could not load config: {:?}", e);
std::process::exit(1);
}
};
debug!("{:?}", config);
let mut server = Server::new(config.base);
debug!("{:?}", server);
let res = server.run();
error!("Server returned an error: {:?}", res);
}