diff options
author | Kevin Guthrie <[email protected]> | 2024-10-21 11:14:20 -0400 |
---|---|---|
committer | Kevin Guthrie <[email protected]> | 2024-10-28 11:51:38 -0400 |
commit | 418d9f7ca19c17f0d81b5563f72e57a1ca814ba0 (patch) | |
tree | 800a3ddee174949a8aca2b0da6102f42aad57991 | |
parent | e94c0a345f587801ac5d1a84281ac90b717cd088 (diff) | |
download | pingora-418d9f7ca19c17f0d81b5563f72e57a1ca814ba0.tar.gz pingora-418d9f7ca19c17f0d81b5563f72e57a1ca814ba0.zip |
Change `new_with_opt_and_conf` to accept `impl Into<Option<Opt>>` instead of explicit option
-rw-r--r-- | .bleep | 2 | ||||
-rw-r--r-- | pingora-core/src/server/mod.rs | 9 |
2 files changed, 6 insertions, 5 deletions
@@ -1 +1 @@ -986270b9e07bce082ff02c86ca183b8c81d7abb8
\ No newline at end of file +5575f7e332f3f097132e2281ce0e09cb0c11edfa
\ No newline at end of file diff --git a/pingora-core/src/server/mod.rs b/pingora-core/src/server/mod.rs index 3622354..c056ed2 100644 --- a/pingora-core/src/server/mod.rs +++ b/pingora-core/src/server/mod.rs @@ -194,12 +194,13 @@ impl Server { /// /// If a configuration file path is provided as part of `opt`, it will be ignored /// and a warning will be logged. - pub fn new_with_opt_and_conf(opt: Option<Opt>, mut conf: ServerConf) -> Server { - if let Some(opt) = &opt { - if let Some(c) = opt.conf.as_ref() { + pub fn new_with_opt_and_conf(raw_opt: impl Into<Option<Opt>>, mut conf: ServerConf) -> Server { + let opt = raw_opt.into(); + if let Some(opts) = &opt { + if let Some(c) = opts.conf.as_ref() { warn!("Ignoring command line argument using '{c}' as configuration, and using provided configuration instead."); } - conf.merge_with_opt(&opt); + conf.merge_with_opt(opts); } let (tx, rx) = watch::channel(false); |