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 { type Config struct {
CurrentLogFile string CurrentLogFile string
LogPath string `yaml:"log_path"` LogPath string `yaml:"log_path"`
BaseURL string `yaml:"base_url"`
Host string `yaml:"host"` Host string `yaml:"host"`
Port int `yaml:"port"` Port int `yaml:"port"`
DownloadPath string `yaml:"downloadPath"` DownloadPath string `yaml:"downloadPath"`

View File

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