hoc/src/main.rs

27 lines
637 B
Rust
Raw Permalink Normal View History

use hoc::{config::Settings, telemetry};
use std::net::TcpListener;
2019-04-19 16:01:47 +02:00
fn init() {
2022-08-31 11:09:23 +02:00
dotenvy::dotenv().ok();
openssl_probe::init_ssl_cert_env_vars();
2019-04-16 16:57:06 +02:00
telemetry::init_subscriber(telemetry::get_subscriber("hoc", "info"))
2019-04-21 20:45:36 +02:00
}
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
init();
2020-11-01 13:57:56 +01:00
// TODO: error handling
let settings = Settings::load().expect("Cannot load config");
let address = format!("{}:{}", settings.host, settings.port);
// TODO: error handling
let listener = TcpListener::bind(address)?;
hoc::run(listener, settings)
.await
.expect("Server error")
2020-11-01 13:57:56 +01:00
.await
2019-07-07 14:52:42 +02:00
}