pub async fn config(field: &str) -> Result<Option<ConfigOption>, ConfigError>Expand description
Retrieves the configuration for a given field.
This function first checks the config table for the requested field. If
it is not found, it will check the configdata table as a fallback using
configdata.
§Arguments
field: The name of the field to retrieve.
§Returns
Ok(Some(ConfigOption))if the field exists.Ok(None)if the field doesn’t exist.Err(ConfigError)if there is an error during retrieval.
§Example
ⓘ
let config_value = config("language").await?;
if let Some(option) = config_value {
println!("Config value: {}", option);
}§Errors
Returns ConfigError::DB if there is an issue with the database connection.