pub struct RelayConfig {
pub tcp: TcpConfig,
pub rtu: RtuConfig,
pub http: HttpConfig,
pub logging: LoggingConfig,
pub connection: ConnectionConfig,
}
Expand description
Main application configuration
Fields§
§tcp: TcpConfig
TCP server configuration
rtu: RtuConfig
RTU client configuration
http: HttpConfig
HTTP API configuration
logging: LoggingConfig
Logging configuration
connection: ConnectionConfig
Connection management configuration
Implementations§
Source§impl Config
impl Config
Sourcepub const CONFIG_DIR: &'static str = "config"
pub const CONFIG_DIR: &'static str = "config"
Default configuration directory
Sourcepub fn new() -> Result<Self, ConfigError>
pub fn new() -> Result<Self, ConfigError>
Build configuration using the following priority (highest to lowest):
- Environment variables (MODBUS_RELAY_*)
- Local configuration file (config/local.yaml)
- Environment specific file (config/{env}.yaml)
- Default configuration (config/default.yaml)
- Built-in defaults
Sourcepub fn from_file(path: PathBuf) -> Result<Self, ConfigError>
pub fn from_file(path: PathBuf) -> Result<Self, ConfigError>
Load configuration from a specific file
Sourcepub fn validate(config: &Self) -> Result<(), ConfigError>
pub fn validate(config: &Self) -> Result<(), ConfigError>
Validate configuration
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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