Skip to content

Commit 6a8836b

Browse files
committed
Merge branch 'dev' of github.com:MassBank/MassBank3 into dev
2 parents a510f69 + 064245e commit 6a8836b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

cmd/mb3server/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,8 @@ func addSwaggerEndpoint(router chi.Router) {
5050
panic("failed to create sub filesystem: " + err.Error())
5151
}
5252

53+
// Serve the swagger-ui files
5354
router.Handle("/ui/*", http.StripPrefix("/ui/", http.FileServer(http.FS(fsys))))
55+
// Redirect root to the swagger-ui
56+
router.Handle("/", http.RedirectHandler(mb3server.ServerConfig.ApiUrl+"/ui/", http.StatusFound))
5457
}

pkg/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type ToolConfig struct {
2121
type ServerConfig struct {
2222
database.DBConfig
2323
ServerPort uint
24+
ApiUrl string
2425
}
2526

2627
const (
@@ -85,6 +86,9 @@ func GetServerConfig() *ServerConfig {
8586
serverConfig.ServerPort = uint(serverPort)
8687
flag.UintVar(&serverConfig.ServerPort, "server_port", serverConfig.ServerPort, "Listen on this port. Overwrites environment variable SERVER_PORT")
8788
flag.Parse()
89+
90+
serverConfig.ApiUrl = getEnv("MB3_API_URL", "")
91+
8892
return serverConfig
8993
}
9094

0 commit comments

Comments
 (0)