Kubernetes fixups according to #157
This commit is contained in:
@@ -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"`
|
||||||
@@ -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())
|
||||||
}()
|
}()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user