Skip to content

Commit 7d2d29e

Browse files
committed
Add default config to main
1 parent 2231519 commit 7d2d29e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/main.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ use crate::model::TiledQuery;
2121
async fn main() -> Result<(), Box<dyn error::Error>> {
2222
let cli = Cli::init();
2323

24-
let config_filepath = cli
25-
.config_filepath
26-
.unwrap_or("Charts/glazed/files/config.toml".into());
24+
let config;
2725

28-
println!("Loading config from {config_filepath:?}");
26+
if let Some(config_filepath) = cli.config_filepath {
27+
println!("Loading config from {config_filepath:?}");
2928

30-
let config = GlazedConfig::from_file(&config_filepath)?;
29+
config = GlazedConfig::from_file(&config_filepath)?;
3130

32-
println!("Config loaded");
31+
println!("Config loaded");
32+
} else {
33+
println!("Using default config");
34+
35+
config = GlazedConfig::default()?;
36+
}
3337

3438
match cli.command {
3539
Commands::Serve => serve(config).await,

0 commit comments

Comments
 (0)