pub fn load_from_env(cfg: &Config) -> Result<Self> {
        let mut mut_config = cfg.clone();
        if std::env::var_os(CONFIG_FILE).is_some() {
            return Config::load_from_toml(
                std::env::var_os(CONFIG_FILE).unwrap().to_str().unwrap(),
            );
        }
        env_helper!(mut_config, log_level, String, LOG_LEVEL);
        env_helper!(mut_config, log_dir, String, LOG_DIR);
        env_helper!(mut_config, num_cpus, u64, NUM_CPUS);
        env_helper!(mut_config, mysql_handler_host, String, MYSQL_HANDLER_HOST);
        env_helper!(mut_config, mysql_handler_port, u16, MYSQL_HANDLER_PORT);
        env_helper!(
            mut_config,
            mysql_handler_thread_num,
            u64,
            MYSQL_HANDLER_THREAD_NUM
        );
        env_helper!(
            mut_config,
            clickhouse_handler_host,
            String,
            CLICKHOUSE_HANDLER_HOST
        );
        env_helper!(
            mut_config,
            clickhouse_handler_port,
            u64,
            CLICKHOUSE_HANDLER_PORT
        );
        env_helper!(
            mut_config,
            clickhouse_handler_thread_num,
            u64,
            CLICKHOUSE_HANDLER_THREAD_NUM
        );
        env_helper!(mut_config, flight_api_address, String, FLIGHT_API_ADDRESS);
        env_helper!(mut_config, http_api_address, String, HTTP_API_ADDRESS);
        env_helper!(mut_config, metric_api_address, String, METRICS_API_ADDRESS);
        env_helper!(mut_config, store_api_address, String, STORE_API_ADDRESS);
        env_helper!(mut_config, store_api_username, User, STORE_API_USERNAME);
        env_helper!(mut_config, store_api_password, Password, STORE_API_PASSWORD);

        Ok(mut_config)
    }
/// Change config based on configured env variable
Change config based on configured env variable
Change config based on configured env variable
pub fn load_from_env(cfg: &Config) -> Result<Self> {
        let mut mut_config = cfg.clone();
        if std::env::var_os(CONFIG_FILE).is_some() {
            return Config::load_from_toml(
                std::env::var_os(CONFIG_FILE).unwrap().to_str().unwrap(),
            );
        }
        env_helper!(mut_config, log_level, String, LOG_LEVEL);
        env_helper!(mut_config, log_dir, String, LOG_DIR);
        env_helper!(mut_config, num_cpus, u64, NUM_CPUS);
        env_helper!(mut_config, mysql_handler_host, String, MYSQL_HANDLER_HOST);
        env_helper!(mut_config, mysql_handler_port, u16, MYSQL_HANDLER_PORT);
        env_helper!(
            mut_config,
            mysql_handler_thread_num,
            u64,
            MYSQL_HANDLER_THREAD_NUM
        );
        env_helper!(
            mut_config,
            clickhouse_handler_host,
            String,
            CLICKHOUSE_HANDLER_HOST
        );
        env_helper!(
            mut_config,
            clickhouse_handler_port,
            u64,
            CLICKHOUSE_HANDLER_PORT
        );
        env_helper!(
            mut_config,
            clickhouse_handler_thread_num,
            u64,
            CLICKHOUSE_HANDLER_THREAD_NUM
        );
        env_helper!(mut_config, flight_api_address, String, FLIGHT_API_ADDRESS);
        env_helper!(mut_config, http_api_address, String, HTTP_API_ADDRESS);
        env_helper!(mut_config, metric_api_address, String, METRICS_API_ADDRESS);
        env_helper!(mut_config, store_api_address, String, STORE_API_ADDRESS);
        env_helper!(mut_config, store_api_username, User, STORE_API_USERNAME);
        env_helper!(mut_config, store_api_password, Password, STORE_API_PASSWORD);
        Ok(mut_config)
    }
pub fn load_from_env ( cfg : & Config ) -> Result < Self > { let mut mut_config = cfg . clone ( ) ; if std :: env :: var_os ( CONFIG_FILE ) . is_some ( ) { return Config :: load_from_toml ( std :: env :: var_os ( CONFIG_FILE ) . unwrap ( ) . to_str ( ) . unwrap ( ) , ) ; } env_helper ! ( mut_config log_level String LOG_LEVEL ) ; env_helper ! ( mut_config log_dir String LOG_DIR ) ; env_helper ! ( mut_config num_cpus u64 NUM_CPUS ) ; env_helper ! ( mut_config mysql_handler_host String MYSQL_HANDLER_HOST ) ; env_helper ! ( mut_config mysql_handler_port u16 MYSQL_HANDLER_PORT ) ; env_helper ! ( mut_config mysql_handler_thread_num u64 MYSQL_HANDLER_THREAD_NUM ) ; env_helper ! ( mut_config clickhouse_handler_host String CLICKHOUSE_HANDLER_HOST ) ; env_helper ! ( mut_config clickhouse_handler_port u64 CLICKHOUSE_HANDLER_PORT ) ; env_helper ! ( mut_config clickhouse_handler_thread_num u64 CLICKHOUSE_HANDLER_THREAD_NUM ) ; env_helper ! ( mut_config flight_api_address String FLIGHT_API_ADDRESS ) ; env_helper ! ( mut_config http_api_address String HTTP_API_ADDRESS ) ; env_helper ! ( mut_config metric_api_address String METRICS_API_ADDRESS ) ; env_helper ! ( mut_config store_api_address String STORE_API_ADDRESS ) ; env_helper ! ( mut_config store_api_username User STORE_API_USERNAME ) ; env_helper ! ( mut_config store_api_password Password STORE_API_PASSWORD ) ; Ok ( mut_config ) }
Change config based on configured env variable
Change config based on configured env variable
cfg
&Config
cfg
&Config