Add /version endpoint with build metadata
- /version returns JSON with build_date and git_commit from env vars - NixOS module injects GIT_COMMIT (first 8 chars of self.rev) and BUILD_DATE (self.lastModified) into systemd service environment
This commit is contained in:
1 parent
3546e19772
commit
338d4cb34e
2 files changed
+11
No files matched your search
@@ -83,6 +83,13 @@ func main() {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte("ok"))
|
||||
})
|
||||
mux.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]string{
|
||||
"build_date": os.Getenv("BUILD_DATE"),
|
||||
"git_commit": os.Getenv("GIT_COMMIT"),
|
||||
})
|
||||
})
|
||||
mux.Handle("/mcp", authMiddleware(token, streamableServer))
|
||||
|
||||
httpServer := &http.Server{
|
||||
|
||||
Reference in new issue
Block a user