mirror of
https://codeberg.org/Toasterson/ips.git
synced 2026-04-10 13:20:42 +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
|
// 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.
|
// In a real scenario we'd want to be more specific about errors.
|
||||||
|
|
||||||
let config = match Config::load(args.config.clone()) {
|
let config = Config::load(args.config.clone()).unwrap_or_else(|e| {
|
||||||
Ok(c) => c,
|
|
||||||
Err(e) => {
|
|
||||||
eprintln!("Failed to load config: {}. Using default.", e);
|
eprintln!("Failed to load config: {}. Using default.", e);
|
||||||
Config {
|
Config {
|
||||||
server: config::ServerConfig {
|
server: config::ServerConfig {
|
||||||
|
|
@ -42,8 +40,7 @@ pub async fn run() -> Result<()> {
|
||||||
admin: None,
|
admin: None,
|
||||||
oauth2: None,
|
oauth2: None,
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
};
|
|
||||||
|
|
||||||
// Init telemetry
|
// Init telemetry
|
||||||
telemetry::init(&config);
|
telemetry::init(&config);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue