backupy-agent/apps/agent/internal/version/version.go
TronoSfera 8b0c978337 feat(initial): Backupy agent + backupy-decrypt CLI
Source ports from the TronoSfera/backupy-cloud monorepo:
- apps/agent/        — Go agent (WSS client, persistent queue, Docker
                       discovery, 5 DB drivers: PG/MySQL/Mongo/Redis/SQLite,
                       pre/post hooks, Prometheus metrics)
- apps/backupy-decrypt/ — standalone CLI for client-side decryption
- packages/proto/    — protobuf wire format (generated .pb.go committed
                       so the repo builds without protoc)
- docs/              — agent spec + wire-protocol contract

Apache-2.0 license. Image published to ghcr.io/tronosfera/backupy-agent
on every v* tag via .github/workflows/release.yml (multi-arch amd64+arm64).
2026-05-17 20:22:35 +03:00

41 lines
1.1 KiB
Go

// Package version exposes build-time information injected via -ldflags.
//
// Example go build:
//
// go build -ldflags "
// -X github.com/backupy/backupy/apps/agent/internal/version.Version=$(VERSION)
// -X github.com/backupy/backupy/apps/agent/internal/version.Commit=$(COMMIT)
// -X github.com/backupy/backupy/apps/agent/internal/version.BuildDate=$(DATE)
// " ./cmd/agent
package version
import "fmt"
// These variables are overwritten by the linker at build time. Defaults
// describe an unstamped local build so `agent version` is always answerable.
var (
Version = "dev"
Commit = "none"
BuildDate = "unknown"
)
// Info is an immutable snapshot of build metadata.
type Info struct {
Version string `json:"version"`
Commit string `json:"commit"`
BuildDate string `json:"build_date"`
}
// Current returns the current build info.
func Current() Info {
return Info{
Version: Version,
Commit: Commit,
BuildDate: BuildDate,
}
}
// Full returns a human-readable single-line version string for CLI output.
func Full() string {
return fmt.Sprintf("%s (commit %s, built %s)", Version, Commit, BuildDate)
}