pub struct ProductionConfigService { /* private fields */ }
Expand description
Production configuration service implementation.
This service loads configuration from multiple sources in order of priority:
- Environment variables (highest priority)
- User configuration file
- Default configuration file (lowest priority)
Configuration is cached after first load for performance.
Implementations§
Source§impl ProductionConfigService
impl ProductionConfigService
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new production configuration service.
§Errors
Returns an error if the configuration builder cannot be initialized. Creates a configuration service using the default environment variable provider (maintains compatibility with existing methods).
Sourcepub fn with_env_provider(
env_provider: Arc<dyn EnvironmentProvider>,
) -> Result<Self>
pub fn with_env_provider( env_provider: Arc<dyn EnvironmentProvider>, ) -> Result<Self>
Create a configuration service using the specified environment variable provider.
§Arguments
env_provider
- Environment variable provider
Sourcepub fn with_custom_file(self, file_path: PathBuf) -> Result<Self>
pub fn with_custom_file(self, file_path: PathBuf) -> Result<Self>
Trait Implementations§
Source§impl ConfigService for ProductionConfigService
impl ConfigService for ProductionConfigService
Source§fn save_config(&self) -> Result<()>
fn save_config(&self) -> Result<()>
Save current configuration to the default file location. Read more
Source§fn save_config_to_file(&self, path: &Path) -> Result<()>
fn save_config_to_file(&self, path: &Path) -> Result<()>
Save configuration to a specific file path. Read more
Source§fn get_config_file_path(&self) -> Result<PathBuf>
fn get_config_file_path(&self) -> Result<PathBuf>
Get the default configuration file path. Read more
Source§fn get_config_value(&self, key: &str) -> Result<String>
fn get_config_value(&self, key: &str) -> Result<String>
Get a specific configuration value by key path. Read more
Auto Trait Implementations§
impl Freeze for ProductionConfigService
impl !RefUnwindSafe for ProductionConfigService
impl Send for ProductionConfigService
impl Sync for ProductionConfigService
impl Unpin for ProductionConfigService
impl !UnwindSafe for ProductionConfigService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more