diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-06-15 11:13:16 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-06-15 11:13:16 -0700 |
| commit | 95159e5585762c06c654945070ba54262b7dcec9 (patch) | |
| tree | 23609018c1460b056ce22067290ea12ee851d483 /cmd/mobius-hotline-server | |
| parent | a6216dd89252fa01dc176f98f1e4ecfd3f637566 (diff) | |
Refactoring and cleanup
* Split CLI client into separate project
* Convert more functions to follow common Golang idioms e.g io.Reader, io.Writer
* Use ldflags for versioning
* Misc cleanup and simplification
Diffstat (limited to 'cmd/mobius-hotline-server')
| -rw-r--r-- | cmd/mobius-hotline-server/main.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd/mobius-hotline-server/main.go b/cmd/mobius-hotline-server/main.go index c027d18..8e66938 100644 --- a/cmd/mobius-hotline-server/main.go +++ b/cmd/mobius-hotline-server/main.go @@ -28,6 +28,12 @@ var logLevels = map[string]slog.Level{ "error": slog.LevelError, } +var ( + version = "dev" + commit = "none" + date = "unknown" +) + func main() { ctx, cancel := context.WithCancel(context.Background()) @@ -50,7 +56,7 @@ func main() { basePort := flag.Int("bind", defaultPort, "Base Hotline server port. File transfer port is base port + 1.") statsPort := flag.String("stats-port", "", "Enable stats HTTP endpoint on address and port") configDir := flag.String("config", defaultConfigPath(), "Path to config root") - version := flag.Bool("version", false, "print version and exit") + printVersion := flag.Bool("version", false, "print version and exit") logLevel := flag.String("log-level", "info", "Log level") logFile := flag.String("log-file", "", "Path to log file") @@ -58,8 +64,8 @@ func main() { flag.Parse() - if *version { - fmt.Printf("v%s\n", hotline.VERSION) + if *printVersion { + fmt.Printf("mobius-hotline-server %s, commit %s, built at %s", version, commit, date) os.Exit(0) } |