diff --git a/pkg/api/api.go b/pkg/api/api.go index b1a6a3a..ebb88d6 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -499,12 +499,7 @@ func GetBookmarks(c *gin.Context) { // GetInfo renders the pgweb system information func GetInfo(c *gin.Context) { - successResponse(c, gin.H{ - "version": command.Version, - "go_version": command.GoVersion, - "git_sha": command.GitCommit, - "build_time": command.BuildTime, - }) + successResponse(c, command.Info) } // DataExport performs database table export diff --git a/pkg/command/version.go b/pkg/command/version.go index 7adedc5..8c85a3a 100644 --- a/pkg/command/version.go +++ b/pkg/command/version.go @@ -14,4 +14,21 @@ var ( // GoVersion contains the build time Go version GoVersion string + + // Info contains all version information + Info VersionInfo ) + +type VersionInfo struct { + Version string `json:"version"` + GitCommit string `json:"git_sha"` + BuildTime string `json:"build_time"` + GoVersion string `json:"go_version"` +} + +func init() { + Info.Version = Version + Info.GitCommit = GitCommit + Info.BuildTime = BuildTime + Info.GoVersion = GoVersion +}