Continuer exécution de serverCmd même sans db

Remplacer log.Fatal par log.Printf si serverCmd ne rejoint pas la db.

Autres changements:

- Clarifier messages d'erreur du *media.MediaClient de serverCmd
- Seulement seed si mediaClient est valide (should always be mais bon)
This commit is contained in:
Victor Lacasse-Beaudoin 2023-10-05 14:11:48 -04:00
parent b2465d2324
commit 76762026f3

View file

@ -48,17 +48,18 @@ var serverCmd = &cobra.Command{
} }
mediaClient, err := media.NewMediaClientFromViper() mediaClient, err := media.NewMediaClientFromViper()
if err != nil { switch err != nil {
log.Fatal(err) case true:
log.Printf("media.NewMediaClientFromViper error: %s", err)
case false:
new_buckets, err := mediaClient.Seed()
if err != nil {
log.Printf("(*media.MediaClient).Seed error: %s", err)
} else {
log.Printf("Seeded %d buckets.\n", len(new_buckets))
}
} }
new_buckets, err := mediaClient.Seed()
if err != nil {
log.Fatal(err)
}
log.Printf("Seeded %d buckets.\n", len(new_buckets))
RunServer() RunServer()
}, },
} }