From 76762026f32c270c9dd1929f178e74643610ab98 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Thu, 5 Oct 2023 14:11:48 -0400 Subject: [PATCH 1/2] =?UTF-8?q?Continuer=20ex=C3=A9cution=20de=20serverCmd?= =?UTF-8?q?=20m=C3=AAme=20sans=20db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- cmd/server.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/server.go b/cmd/server.go index 1149cb3..aac8313 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -48,17 +48,18 @@ var serverCmd = &cobra.Command{ } mediaClient, err := media.NewMediaClientFromViper() - if err != nil { - log.Fatal(err) + switch err != nil { + 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() }, } From 84dc500a772c78779942d800e95c5f3aba94813a Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Thu, 5 Oct 2023 14:23:06 -0400 Subject: [PATCH 2/2] Afficher message si documentation n'est pas disponible --- templates/html/documentation.gohtml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/templates/html/documentation.gohtml b/templates/html/documentation.gohtml index ce687a0..ea18bd3 100644 --- a/templates/html/documentation.gohtml +++ b/templates/html/documentation.gohtml @@ -12,17 +12,21 @@

Documentation

- {{ range .Data.Buckets }} - {{ $bucket_name := .Name }} - {{ $bucket_display_name := .DisplayName }} -

- {{ $bucket_display_name }} -
    - {{ range .Documents }} -
  • {{ . }}
  • - {{ end}} -
-
+ {{ if not .Data.Buckets }} +Documentation non-accessible pour l'instant, merci de votre patience + {{ else }} + {{ range .Data.Buckets }} + {{ $bucket_name := .Name }} + {{ $bucket_display_name := .DisplayName }} +
+ {{ $bucket_display_name }} +
    + {{ range .Documents }} +
  • {{ . }}
  • + {{ end}} +
+
+ {{ end }} {{ end }}