pub struct BackboneConfig {
pub app: AppConfig,
pub server: ServerConfig,
pub database: HashMap<String, DatabaseConfig>,
pub cache: HashMap<String, CacheConfig>,
pub modules: ModulesConfig,
pub logging: LoggingConfig,
pub monitoring: MonitoringConfig,
pub contexts: ContextsConfig,
pub features: FeaturesConfig,
pub security: SecurityConfig,
}Expand description
Main configuration struct for Backbone Framework
Contains all configuration sections needed to run a Backbone application. Supports loading from YAML, TOML, or JSON files with environment variable substitution.
Fields§
§app: AppConfigApplication metadata
server: ServerConfigServer configuration
database: HashMap<String, DatabaseConfig>Database configurations (keyed by name)
cache: HashMap<String, CacheConfig>Cache configurations (keyed by name)
modules: ModulesConfigModule configurations
logging: LoggingConfigLogging configuration
monitoring: MonitoringConfigMonitoring configuration
contexts: ContextsConfigCross-context communication
features: FeaturesConfigFeature flags
security: SecurityConfigSecurity settings
Implementations§
Source§impl BackboneConfig
impl BackboneConfig
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> ConfigResult<Self>
pub fn from_file<P: AsRef<Path>>(path: P) -> ConfigResult<Self>
Sourcepub fn from_file_with_env<P: AsRef<Path>>(
base_path: P,
env: &str,
) -> ConfigResult<Self>
pub fn from_file_with_env<P: AsRef<Path>>( base_path: P, env: &str, ) -> ConfigResult<Self>
Load configuration with environment-specific overrides
Loads base config from {base_path} and merges with
{base_path}-{env}.{ext} if it exists.
§Example
// Loads config/application.yml + config/application-development.yml
let config = BackboneConfig::from_file_with_env(
"config/application.yml",
"development"
)?;Sourcepub fn from_env() -> ConfigResult<Self>
pub fn from_env() -> ConfigResult<Self>
Load configuration from environment variables only
Uses default values and overrides with environment variables.
Sourcepub fn validate(&self) -> ConfigResult<()>
pub fn validate(&self) -> ConfigResult<()>
Validate the configuration
Returns an error if any critical configuration is invalid.
Sourcepub fn default_database(&self) -> Option<&DatabaseConfig>
pub fn default_database(&self) -> Option<&DatabaseConfig>
Get the default database configuration
Sourcepub fn get_database(&self, name: &str) -> Option<&DatabaseConfig>
pub fn get_database(&self, name: &str) -> Option<&DatabaseConfig>
Get a database configuration by name
Sourcepub fn default_cache(&self) -> Option<&CacheConfig>
pub fn default_cache(&self) -> Option<&CacheConfig>
Get the default cache configuration
Sourcepub fn get_cache(&self, name: &str) -> Option<&CacheConfig>
pub fn get_cache(&self, name: &str) -> Option<&CacheConfig>
Get a cache configuration by name
Sourcepub fn is_module_enabled(&self, module_name: &str) -> bool
pub fn is_module_enabled(&self, module_name: &str) -> bool
Check if a module is enabled
Sourcepub fn environment(&self) -> &Environment
pub fn environment(&self) -> &Environment
Get the current environment
Sourcepub fn is_production(&self) -> bool
pub fn is_production(&self) -> bool
Check if running in production
Sourcepub fn is_development(&self) -> bool
pub fn is_development(&self) -> bool
Check if running in development
Trait Implementations§
Source§impl Clone for BackboneConfig
impl Clone for BackboneConfig
Source§impl Debug for BackboneConfig
impl Debug for BackboneConfig
Source§impl Default for BackboneConfig
impl Default for BackboneConfig
Source§impl<'de> Deserialize<'de> for BackboneConfig
impl<'de> Deserialize<'de> for BackboneConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for BackboneConfig
impl RefUnwindSafe for BackboneConfig
impl Send for BackboneConfig
impl Sync for BackboneConfig
impl Unpin for BackboneConfig
impl UnsafeUnpin for BackboneConfig
impl UnwindSafe for BackboneConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more