mirror of
https://codeberg.org/Toasterson/ips.git
synced 2026-04-10 21:30:41 +00:00
Simplify config loading by replacing match with unwrap_or_else for improved readability.
This commit is contained in:
parent
81bc7b8574
commit
ee02bf3cf0
1 changed files with 20 additions and 23 deletions
|
|
@ -20,9 +20,7 @@ pub async fn run() -> Result<()> {
|
|||
// For M1, let's just create a dummy default if not found/failed for testing purposes
|
||||
// In a real scenario we'd want to be more specific about errors.
|
||||
|
||||
let config = match Config::load(args.config.clone()) {
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
let config = Config::load(args.config.clone()).unwrap_or_else(|e| {
|
||||
eprintln!("Failed to load config: {}. Using default.", e);
|
||||
Config {
|
||||
server: config::ServerConfig {
|
||||
|
|
@ -42,8 +40,7 @@ pub async fn run() -> Result<()> {
|
|||
admin: None,
|
||||
oauth2: None,
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// Init telemetry
|
||||
telemetry::init(&config);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue