1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use support_common::config::{Config, ConfigFormat, Names};

use crate::config::BridgerConfig;

pub fn init() -> color_eyre::Result<()> {
    support_common::initialize::init()?;
    init_default_config()?;
    Ok(())
}

fn init_default_config() -> color_eyre::Result<()> {
    if Config::exists(Names::Bridger) {
        return Ok(());
    }
    tracing::info!(target: "bridger", "The config not found, create default config");
    let config = BridgerConfig::default();
    Config::store_with_format(Names::Bridger, config, ConfigFormat::Toml)
}