INNER CODE UNIT · Rust

run

ilya-zlobintsev/LACT · lact-daemon/src/lib.rs:47

pub fn run() -> anyhow::Result<()> {
    let rt = runtime::Builder::new_current_thread()
        .enable_all()
        .build_local(LocalOptions::default())
        .expect("Could not initialize tokio runtime");
    rt.block_on(async {
        let config = Config::load_or_create()?;

        let env_filter = EnvFilter::builder()
            .with_default_directive(LevelFilter::INFO.into())
            .parse(&config.daemon.log_level)
            .context("Invalid log level")?;
        tracing_subscriber::fmt().with_env_filter(env_filter).init();

        let server = Server::new(config).await?;
        let handler = server.handler.clone();

        tokio::task::spawn_local(listen_config_changes(handler.clone()));

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…