Co-authored-by: gobha <jasafpro@gmail.com> Co-committed-by: gobha <jasafpro@gmail.com>
26 lines
522 B
Go
26 lines
522 B
Go
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
|
|
}
|
|
}
|
|
}
|
|
}
|