pub struct ConfigBuilder { /* private fields */ }Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
pub fn new() -> Self
Sourcepub fn from_file<P: AsRef<Path>>(self, path: P) -> Result<Self, Box<dyn Error>>
pub fn from_file<P: AsRef<Path>>(self, path: P) -> Result<Self, Box<dyn Error>>
Load configuration from a YAML file with optimized error handling. This will merge or overwrite existing configuration depending on implementation. Here we assume it loads the base config.
pub fn with_tls(self, tls: TlsSettings) -> Self
pub fn add_upstream(self, upstream: Upstream) -> Self
pub fn add_service(self, service: Service) -> Self
Sourcepub fn configure<F>(self, func: F) -> Self
pub fn configure<F>(self, func: F) -> Self
A generic extension point. Users can pass a closure to modify the internal config directly. This allows for arbitrary modifications without changing the Builder struct.
Example:
use jokoway_core::config::ConfigBuilder;
let builder = ConfigBuilder::new();
builder.configure(|cfg, _server_conf| {
cfg.http_listen = "0.0.0.0:8080".to_string();
});pub fn build(self) -> (JokowayConfig, Option<ServerConf>)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnsafeUnpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
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