modo/geolocation/config.rs
1use serde::Deserialize;
2
3/// Configuration for the geolocation module.
4///
5/// Deserializes from the `geolocation` section of the application YAML config.
6/// `Default` produces an empty `mmdb_path`; constructing a [`GeoLocator`] from
7/// a default config will return an error.
8///
9/// [`GeoLocator`]: super::GeoLocator
10#[non_exhaustive]
11#[derive(Debug, Clone, Deserialize, Default)]
12#[serde(default)]
13pub struct GeolocationConfig {
14 /// Path to the MaxMind GeoLite2 or GeoIP2 `.mmdb` database file.
15 ///
16 /// Supports `${VAR}` and `${VAR:default}` env-var substitution when loaded
17 /// through the framework's config loader. An empty path causes
18 /// [`GeoLocator::from_config`](super::GeoLocator::from_config) to return an error.
19 pub mmdb_path: String,
20}