From 9b4aa6e37016b2c478b42797d6c546b9996181bf Mon Sep 17 00:00:00 2001 From: surtur Date: Sun, 13 Aug 2023 17:00:46 +0200 Subject: [PATCH] go: mv flags to flag.go --- flag.go | 18 ++++++++++++++++++ run.go | 11 +---------- 2 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 flag.go diff --git a/flag.go b/flag.go new file mode 100644 index 0000000..04ca0c6 --- /dev/null +++ b/flag.go @@ -0,0 +1,18 @@ +// Copyright 2023 wanderer +// SPDX-License-Identifier: AGPL-3.0-only + +package main + +import "flag" + +var ( + hostFlag = flag.String("host", "unset", "host address to listen on") + portFlag = flag.Int("port", 0, "TCP port to listen on") + configFlag = flag.String("config", "config.dhall", "Default path of the config file") + configIsPathFlag = flag.Bool("configIsPath", true, "Whether the provided config is path or raw config") + develFlag = flag.Bool("devel", false, "Run the application in dev mode, connect to a local browser-sync instance for hot-reloading") + licenseFlag = flag.Bool("license", false, "Print licensing information and exit") + versionFlag = flag.Bool("version", false, "Print version and exit") + importFlag = flag.String("import", "", "Path to import breach data from") + printMigrationFlag = flag.Bool("printMigration", false, "Print to stdout what is about to happen during the following database migration (mainly useful for debugging") +) diff --git a/run.go b/run.go index 12b29cf..bea1d69 100644 --- a/run.go +++ b/run.go @@ -60,16 +60,7 @@ along with this program. If not, see .` ) var ( - hostFlag = flag.String("host", "unset", "host address to listen on") - portFlag = flag.Int("port", 0, "TCP port to listen on") - configFlag = flag.String("config", "config.dhall", "Default path of the config file") - configIsPathFlag = flag.Bool("configIsPath", true, "Whether the provided config is path or raw config") - develFlag = flag.Bool("devel", false, "Run the application in dev mode, connect to a local browser-sync instance for hot-reloading") - licenseFlag = flag.Bool("license", false, "Print licensing information and exit") - versionFlag = flag.Bool("version", false, "Print version and exit") - importFlag = flag.String("import", "", "Path to import breach data from") - printMigrationFlag = flag.Bool("printMigration", false, "Print to stdout what is about to happen during the following database migration (mainly useful for debugging") - version = "dev" + version = "dev" // the global logger. slogger *slogging.Slogger // local logger instance.