minimize scope of changes by reverting change to settings.rs
This commit is contained in:
parent
e9e362d4bd
commit
99008ac03e
@ -58,7 +58,7 @@ fn main() -> Result<(), String> {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut settings = settings::Settings::new(settings_path)
|
let mut settings = settings::Settings::new(settings_path.as_ref().map(|x| x.as_os_str()))
|
||||||
.map_err(|e| format!("configuration is invalid: {}", e))?;
|
.map_err(|e| format!("configuration is invalid: {}", e))?;
|
||||||
|
|
||||||
// Set config from command line
|
// Set config from command line
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use directories::*;
|
use directories::*;
|
||||||
|
|
||||||
use serde_derive::*;
|
use serde_derive::*;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsStr;
|
||||||
use std::net::{SocketAddr, ToSocketAddrs};
|
use std::net::{SocketAddr, ToSocketAddrs};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
@ -234,13 +234,13 @@ impl Settings {
|
|||||||
default_log_directory
|
default_log_directory
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(config_file: Option<OsString>) -> Result<Self, config::ConfigError> {
|
pub fn new(config_file: Option<&OsStr>) -> Result<Self, config::ConfigError> {
|
||||||
// Load the default config
|
// Load the default config
|
||||||
let mut cfg = load_default_config()?;
|
let mut cfg = load_default_config()?;
|
||||||
|
|
||||||
// Merge in the config file if we have one
|
// Merge in the config file if we have one
|
||||||
if let Some(config_file) = config_file {
|
if let Some(config_file) = config_file {
|
||||||
let config_file_path = Path::new(&config_file);
|
let config_file_path = Path::new(config_file);
|
||||||
// If the user specifies a config file on the command line then it must exist
|
// If the user specifies a config file on the command line then it must exist
|
||||||
cfg = load_config(cfg, config_file_path)?;
|
cfg = load_config(cfg, config_file_path)?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user