Permettre exécution sans base de donnée #152

Merged
vlbeaudoin merged 2 commits from change/allow-running-without-db into main 2023-10-05 15:32:37 -04:00
2 changed files with 25 additions and 20 deletions

View file

@ -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()
},
}

View file

@ -12,17 +12,21 @@
<div class="wrapper documentationWrapper">
<h1 class="heading1">Documentation</h1>
<p>
{{ range .Data.Buckets }}
{{ $bucket_name := .Name }}
{{ $bucket_display_name := .DisplayName }}
<details class="documentationCategorie">
<summary class="documentationDescription">{{ $bucket_display_name }}</summary>
<ul class="documentationListe">
{{ range .Documents }}
<a class ="documentationLien" href="/public/documentation/{{ $bucket_name }}/{{ . }}"><li class="documentationDocument">{{ . }}</li></a>
{{ end}}
</ul>
</details>
{{ 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 }}
<details class="documentationCategorie">
<summary class="documentationDescription">{{ $bucket_display_name }}</summary>
<ul class="documentationListe">
{{ range .Documents }}
<a class ="documentationLien" href="/public/documentation/{{ $bucket_name }}/{{ . }}"><li class="documentationDocument">{{ . }}</li></a>
{{ end}}
</ul>
</details>
{{ end }}
{{ end }}
</p>
<p>