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
All checks were successful
Build and push container image / build-and-push (push) Successful in 4m50s
This commit is contained in:
parent
fc04ea7900
commit
1b4d24cada
1 changed files with 5 additions and 3 deletions
8
main.go
8
main.go
|
|
@ -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})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue