use crate::config::map::ConfigMap;
#[cfg(feature = "config-server")]
pub mod config_server;
pub mod env;
pub mod file;
pub mod memory;
#[cfg(feature = "vault")]
pub mod vault;
#[cfg(feature = "config-server")]
pub use config_server::{ConfigServerFormat, ConfigServerProvider};
pub use env::EnvProvider;
pub use file::FileProvider;
pub use memory::MemoryProvider;
#[cfg(feature = "vault")]
pub use vault::{VaultAuth, VaultProvider};
use crate::error::ConfigError;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ProviderKind {
Env,
File,
Vault,
ConfigServer,
Memory,
}
impl ProviderKind {
pub fn is_file_secret_source(&self) -> bool {
matches!(self, ProviderKind::File)
}
}
#[async_trait::async_trait]
pub trait ConfigProvider: Send + Sync {
fn name(&self) -> String;
fn kind(&self) -> ProviderKind;
async fn load(&self) -> Result<ConfigMap, ConfigError>;
}