move the variables set during the building process into the core package

This commit is contained in:
MaysWind
2026-02-15 01:12:48 +08:00
parent 76d1d3aef3
commit 3a66a3d655
10 changed files with 33 additions and 35 deletions
+2 -3
View File
@@ -3,7 +3,6 @@ package api
import (
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
// HealthsApi represents health api
@@ -18,8 +17,8 @@ var (
func (a *HealthsApi) HealthStatusHandler(c *core.WebContext) (any, *errs.Error) {
result := make(map[string]string)
result["version"] = settings.Version
result["commit"] = settings.CommitHash
result["version"] = core.Version
result["commit"] = core.CommitHash
result["status"] = "ok"
return result, nil
+1 -1
View File
@@ -103,7 +103,7 @@ func (a *ModelContextProtocolAPI) InitializeHandler(c *core.WebContext, jsonRPCR
ServerInfo: &mcp.MCPImplementation{
Name: mcpServerName,
Title: core.ApplicationName,
Version: settings.Version,
Version: core.Version,
},
}
+4 -5
View File
@@ -3,7 +3,6 @@ package api
import (
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
// SystemsApi represents system api
@@ -18,11 +17,11 @@ var (
func (a *SystemsApi) VersionHandler(c *core.WebContext) (any, *errs.Error) {
result := make(map[string]string)
result["version"] = settings.Version
result["commitHash"] = settings.CommitHash
result["version"] = core.Version
result["commitHash"] = core.CommitHash
if settings.BuildTime != "" {
result["buildTime"] = settings.BuildTime
if core.BuildTime != "" {
result["buildTime"] = core.BuildTime
}
return result, nil