Prefer build-time version over runtime SOURCE_COMMIT (Coolify sets HEAD)
All checks were successful
Build and push container image / build-and-push (push) Successful in 4m50s

This commit is contained in:
Christoph Haas 2026-08-22 11:59:14 +02:00
parent fc04ea7900
commit 1b4d24cada

View file

@ -220,9 +220,11 @@ func healthHandler(w http.ResponseWriter, r *http.Request) {
}
func versionHandler(w http.ResponseWriter, r *http.Request) {
v := os.Getenv("SOURCE_COMMIT")
if v == "" {
v = version
v := version
if v == "" || v == "dev" {
if e := os.Getenv("SOURCE_COMMIT"); e != "" {
v = e
}
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"version": v})