/// Load the configuration file
/// If not exists, create it and return the default configuration
Load the configuration file
If not exists, create it and return the default configuration
Load the configuration file If not exists create it and return the default configuration
pub fn load() -> Result<Self, Box<dyn std::error::Error>> {
        let opts = Configuration::get_cli_args()?;
        let path = PathBuf::from(&opts.config_file);
        let mut configuration = Configuration::default();
        if !path.exists() {
            configuration.override_config(&opts);
            Configuration::create(&path, &configuration)?;
        } else {
            configuration = Configuration::read(&path)?;
            if opts.override_config {
                configuration.override_config(&opts);
            }
        };
        // Init the logger with the log level defined by the -v option.
        env_logger::Builder::from_env(Env::default().default_filter_or(opts.get_log_level()))
            .init();
        debug!("Loaded configuration from file {}", path.display());
        configuration.bootstrap()?;
        Ok(configuration)
    }
pub fn load ( ) -> Result < Self , Box < dyn std :: error :: Error > > { let opts = Configuration :: get_cli_args ( ) ? ; let path = PathBuf :: from ( & opts . config_file ) ; let mut configuration = Configuration :: default ( ) ; if ! path . exists ( ) { configuration . override_config ( & opts ) ; Configuration :: create ( & path , & configuration ) ? ; } else { configuration = Configuration :: read ( & path ) ? ; if opts . override_config { configuration . override_config ( & opts ) ; } } ; // Init the logger with the log level defined by the -v option. env_logger :: Builder :: from_env ( Env :: default ( ) . default_filter_or ( opts . get_log_level ( ) ) ) . init ( ) ; debug ! ( " " path display ( ) ) ; configuration . bootstrap ( ) ? ; Ok ( configuration ) }
Load the configuration file
If not exists, create it and return the default configuration
Load the configuration file If not exists create it and return the default configuration