package main

import (
	"os"
	"strings"
)

// Version is the application version.
// In Docker builds, injected via ldflags from the VERSION file.
// In local dev, read from ../VERSION at startup.
var Version = "dev"

func init() {
	if Version == "dev" {
		if b, err := os.ReadFile("../VERSION"); err == nil {
			if v := strings.TrimSpace(string(b)); v != "" {
				Version = v
			}
		} else if b, err := os.ReadFile("VERSION"); err == nil {
			if v := strings.TrimSpace(string(b)); v != "" {
				Version = v
			}
		}
	}
}
