Kubernetes fixups according to #157

This commit is contained in:
2024-06-09 11:21:13 +02:00
parent 7ea1c0b205
commit 0b0ba4718c
2 changed files with 7 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ import (
type Config struct {
CurrentLogFile string
LogPath string `yaml:"log_path"`
BaseURL string `yaml:"base_url"`
Host string `yaml:"host"`
Port int `yaml:"port"`
DownloadPath string `yaml:"downloadPath"`

View File

@@ -157,8 +157,11 @@ func newServer(c serverConfig) *http.Server {
// use in dev
// r.Use(middleware.Logger)
r.Mount("/", http.FileServer(http.FS(c.frontend)))
r.Mount("/openapi", http.FileServer(http.FS(c.swagger)))
baseUrl := config.Instance().BaseURL
r.Mount(baseUrl+"/", http.StripPrefix(baseUrl, http.FileServerFS(c.frontend)))
// swagger
r.Mount("/openapi", http.FileServerFS(c.swagger))
// Archive routes
r.Route("/archive", func(r chi.Router) {
@@ -209,7 +212,7 @@ func gracefulShutdown(srv *http.Server, db *internal.MemoryDB) {
defer func() {
db.Persist()
stop()
srv.Shutdown(context.TODO())
srv.Shutdown(context.Background())
}()
}()
}