agent build

This commit is contained in:
2026-08-28 12:21:44 +05:30
parent b6f8655909
commit f7df96c973
138 changed files with 24164 additions and 207 deletions

View File

@@ -24,6 +24,15 @@ import (
"github.com/krow/krow-backend/go-api/internal/httpserver"
)
// version is stamped at link time:
//
// go build -ldflags="-X main.version=$(git rev-parse --short HEAD)"
//
// The Dockerfile passes its VERSION build arg through to this. "dev" is what an
// unstamped local build reports, which is honest — it says the binary was not
// built by the release path rather than inventing a number.
var version = "dev"
func main() {
if err := run(); err != nil {
slog.Error("fatal", "error", err)
@@ -38,7 +47,8 @@ func run() error {
}
log := newLogger(cfg.Log.Level)
log.Info("starting krow-api", "env", cfg.AppEnv, "database", cfg.DB.Redacted())
log.Info("starting krow-api", "version", version,
"env", cfg.AppEnv, "database", cfg.DB.Redacted())
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
@@ -50,7 +60,7 @@ func run() error {
defer database.Close()
log.Info("database connected", "schema", cfg.DB.Schema)
server, err := httpserver.New(cfg, database, log)
server, err := httpserver.New(cfg, database, log, httpserver.WithBuildVersion(version))
if err != nil {
return err
}