automatic versioning on tags
This commit is contained in:
@@ -2,9 +2,11 @@ package internal
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -422,3 +424,19 @@ func HandleSearch(c echo.Context) error {
|
||||
|
||||
return c.JSON(http.StatusOK, results)
|
||||
}
|
||||
|
||||
// HandleVersion returns the application version
|
||||
func HandleVersion(c echo.Context) error {
|
||||
// Try to read version from version.json file first (Docker builds)
|
||||
versionFile := "/app/version.json"
|
||||
if data, err := os.ReadFile(versionFile); err == nil {
|
||||
var versionData map[string]string
|
||||
if err := json.Unmarshal(data, &versionData); err == nil {
|
||||
return c.JSON(http.StatusOK, versionData)
|
||||
}
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, map[string]string{
|
||||
"version": "dev",
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user