pub struct Config {
pub providers: ProvidersConfig,
pub routes: Vec<Route>,
pub storage: StorageConfig,
}Fields§
§providers: ProvidersConfig§routes: Vec<Route>§storage: StorageConfigImplementations§
Source§impl Config
impl Config
Sourcepub fn from_yaml_str(text: &str) -> Result<Self, SignalError>
pub fn from_yaml_str(text: &str) -> Result<Self, SignalError>
Parses a single, self-contained config from YAML text,
interpolating ${VAR} placeholders and checking that every route
names a configured provider. A file that uses extends needs to
be loaded from where it lives, with Config::from_file or
$SIGNAL_CONFIG, so its parents can be found.
Sourcepub fn from_layers(
layers: impl IntoIterator<Item = (Option<String>, Layer)>,
) -> Result<Self, SignalError>
pub fn from_layers( layers: impl IntoIterator<Item = (Option<String>, Layer)>, ) -> Result<Self, SignalError>
Merges a chain of layers, given lowest priority first, each with the name of the file it came from (for error messages):
- providers merge by name, and a later layer’s entry replaces an earlier one’s;
- a later layer’s routes go before the earlier layers’ routes, so the more specific file is matched first and the shared defaults still catch everything else;
storagecomes from the last layer that sets it.
Routes are checked against the merged providers.
Sourcepub fn load(
sources: &[ConfigSource],
opts: &LoadOptions,
) -> Result<Self, SignalError>
pub fn load( sources: &[ConfigSource], opts: &LoadOptions, ) -> Result<Self, SignalError>
Loads and merges sources once, resolving secret placeholders;
see crate::source.
pub fn from_file(path: &Path) -> Result<Self, SignalError>
Sourcepub fn discover() -> Result<Self, SignalError>
pub fn discover() -> Result<Self, SignalError>
$SIGNAL_CONFIG if set (one or more comma-separated local
files, which must then exist, or remote URLs), else
./signal.yaml if present, else the zero-config default. Remote
files are fetched once, with the cache fallback described in
crate::source.
pub fn routing(&self) -> RoutingConfig
Sourcepub fn provider_names(&self) -> Vec<&'static str>
pub fn provider_names(&self) -> Vec<&'static str>
Names of the providers this config makes available. console
is always present because routing falls back to it.