feat: bake version into binary and display in UI sidebar
- Inject VERSION via ldflags (-X main=web.Version=) and git short SHA
- Add /api/version endpoint returning {version, commit}
- Display version in Layout sidebar footer (v0.1.6 · 8cfd405)
- Add AGENTS.md section documenting SemVer policy and bump-before-push rule
- Bump VERSION 0.1.5 -> 0.1.6 in Makefile
This commit is contained in:
+7
-1
@@ -17,6 +17,11 @@ import (
|
||||
"github.com/darroyo/nasctl/internal/web"
|
||||
)
|
||||
|
||||
var (
|
||||
version = "dev"
|
||||
commit = ""
|
||||
)
|
||||
|
||||
func main() {
|
||||
addr := flag.String("addr", envOrDefault("NASCTL_ADDR", ":8080"), "HTTP listen address")
|
||||
dbPath := flag.String("db", envOrDefault("NASCTL_DB", "/var/lib/nasctl/nasctl.db"), "SQLite database path")
|
||||
@@ -79,6 +84,7 @@ func main() {
|
||||
})
|
||||
|
||||
eng := engine.New(sambaModule, nfsModule, usersModule)
|
||||
web.SetVersionInfo(version, commit)
|
||||
srv := web.NewServer(database, eng, web.Options{
|
||||
AllowedRoots: parseRoots(*allowedRoots),
|
||||
Auth: auth,
|
||||
@@ -86,7 +92,7 @@ func main() {
|
||||
ExportsPath: *exportsPath,
|
||||
})
|
||||
|
||||
log.Printf("nasctl listening on %s (db=%s exec-system=%v)", *addr, *dbPath, *execSystem)
|
||||
log.Printf("nasctl %s (commit %s) listening on %s (db=%s exec-system=%v)", version, commit, *addr, *dbPath, *execSystem)
|
||||
if err := http.ListenAndServe(*addr, srv.Handler()); err != nil {
|
||||
log.Fatalf("server error: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user