merge
This commit is contained in:
commit
e173dc9efa
5 changed files with 336 additions and 6 deletions
14
src/main.rs
14
src/main.rs
|
|
@ -37,8 +37,13 @@ async fn main() {
|
|||
log_in!("Incoming messages");
|
||||
log_out!("Outgoing messages");
|
||||
|
||||
let omikron_port: u16 = env::var("OMIKRON_PORT")
|
||||
.ok()
|
||||
.and_then(|s| s.parse().ok())
|
||||
.unwrap_or(9187);
|
||||
|
||||
tokio::spawn(async move {
|
||||
match omikron_connection::start(9187).await {
|
||||
match omikron_connection::start(omikron_port).await {
|
||||
Err(e) => log_err!(0, PrintType::General, "{:?}", e),
|
||||
_ => {}
|
||||
}
|
||||
|
|
@ -68,7 +73,12 @@ async fn main() {
|
|||
log!(" Users");
|
||||
}
|
||||
|
||||
let _ = server::server::start(9188).await;
|
||||
let api_port: u16 = env::var("API_PORT")
|
||||
.ok()
|
||||
.and_then(|s| s.parse().ok())
|
||||
.unwrap_or(9188);
|
||||
|
||||
let _ = server::server::start(api_port).await;
|
||||
|
||||
tokio::signal::ctrl_c().await.unwrap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ pub async fn start(port: u16) -> anyhow::Result<()> {
|
|||
|
||||
config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
|
||||
|
||||
let addr = format!("0.0.0.0:{port}");
|
||||
let bind_addr = std::env::var("BIND_ADDRESS").unwrap_or_else(|_| "0.0.0.0".to_string());
|
||||
let addr = format!("{}:{}", bind_addr, port);
|
||||
log!(" Server on {}", addr);
|
||||
|
||||
HttpServer::new(move || {
|
||||
|
|
|
|||
|
|
@ -163,9 +163,8 @@ pub fn get_children(path: &str) -> Vec<String> {
|
|||
}
|
||||
|
||||
pub fn get_directory() -> String {
|
||||
let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("."));
|
||||
exe.parent()
|
||||
.unwrap_or(Path::new("."))
|
||||
std::env::current_dir()
|
||||
.unwrap_or_else(|_| PathBuf::from("."))
|
||||
.to_string_lossy()
|
||||
.to_string()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue