modo-rs 0.11.0

Rust web framework for small monolithic apps
Documentation
use serde::Deserialize;

/// Configuration for the geolocation module.
///
/// Deserializes from the `geolocation` section of the application YAML config.
/// `Default` produces an empty `mmdb_path`; constructing a [`GeoLocator`] from
/// a default config will return an error.
///
/// [`GeoLocator`]: super::GeoLocator
#[non_exhaustive]
#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default)]
pub struct GeolocationConfig {
    /// Path to the MaxMind GeoLite2 or GeoIP2 `.mmdb` database file.
    ///
    /// Supports `${VAR}` and `${VAR:default}` env-var substitution when loaded
    /// through the framework's config loader. An empty path causes
    /// [`GeoLocator::from_config`](super::GeoLocator::from_config) to return an error.
    pub mmdb_path: String,
}