Skip to main content

config_resolver/providers/
mod.rs

1use crate::error::Error;
2use crate::types::ResolvedValue;
3use async_trait::async_trait;
4
5/// A trait for providing configuration values dynamically.
6#[async_trait]
7pub trait ConfigProvider: Send + Sync {
8    /// Returns the unique name of the provider (e.g., "AWS_PUBLIC_IP").
9    fn name(&self) -> &str;
10
11    /// Resolves the configuration value asynchronously.
12    async fn resolve(&self) -> Result<ResolvedValue, Error>;
13
14    /// Resolves the configuration value synchronously.
15    fn resolve_sync(&self) -> Result<ResolvedValue, Error> {
16        Err(Error::SyncResolutionNotSupported(self.name().to_string()))
17    }
18}
19
20#[cfg(feature = "aws")]
21pub mod aws;
22#[cfg(feature = "digital-ocean")]
23pub mod digital_ocean;
24#[cfg(feature = "ipify")]
25pub mod ipify;
26
27#[cfg(feature = "aws")]
28pub use aws::*;
29#[cfg(feature = "digital-ocean")]
30pub use digital_ocean::*;
31#[cfg(feature = "ipify")]
32pub use ipify::*;