Skip to main content

load_config

Function load_config 

Source
pub async fn load_config(
    file_path: Option<&Path>,
    db_settings: HashMap<String, String>,
) -> Result<AppConfig, ConfigError>
Expand description

Load configuration from file and environment

Order of precedence (highest to lowest):

  1. Environment variables (DBRST_*)
  2. Config file values
  3. Default values

§Arguments

  • file_path - Optional path to configuration file
  • db_settings - Optional settings loaded from database (deferred to Phase 3)

§Examples

let config = load_config(Some(Path::new("config.toml")), HashMap::new()).await?;