better way to allow no config

This commit is contained in:
Bryan Stitt 2023-01-22 17:48:33 -08:00
parent 51a9beaf6f
commit ec5c28b64b

View File

@ -117,15 +117,14 @@ fn main() -> anyhow::Result<()> {
let mut cli_config: Web3ProxyCli = argh::from_env();
if cli_config.config.is_none() && cli_config.db_url.is_none() {
if cli_config.config.is_none() && cli_config.db_url.is_none() && cli_config.sentry_url.is_none()
{
// TODO: default to example.toml if development.toml doesn't exist
info!("defaulting to development config");
cli_config.config = Some("./config/development.toml".to_string());
}
let top_config = if let Some(top_config_path) = cli_config.config.clone() {
if top_config_path.is_empty() {
None
} else {
let top_config_path = Path::new(&top_config_path)
.canonicalize()
.context(format!("checking for config at {}", top_config_path))?;
@ -155,7 +154,6 @@ fn main() -> anyhow::Result<()> {
}
Some(top_config)
}
} else {
None
};