From 6eefca53c835a91f89e629fb15d99df99dfd06cb Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Mon, 25 Oct 2021 00:38:09 -0700 Subject: [PATCH] Split out flags so all functions in main have access --- main.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/main.go b/main.go index e77f861b5..25c257d23 100644 --- a/main.go +++ b/main.go @@ -16,14 +16,18 @@ import ( "github.com/owncast/owncast/utils" ) -func main() { - dbFile := flag.String("database", "", "Path to the database file.") - logDirectory := flag.String("logdir", "", "Directory where logs will be written to") - backupDirectory := flag.String("backupdir", "", "Directory where backups will be written to") - enableDebugOptions := flag.Bool("enableDebugFeatures", false, "Enable additional debugging options.") - enableVerboseLogging := flag.Bool("enableVerboseLogging", false, "Enable additional logging.") - restoreDatabaseFile := flag.String("restoreDatabase", "", "Restore an Owncast database backup") +var dbFile = flag.String("database", "", "Path to the database file.") +var logDirectory = flag.String("logdir", "", "Directory where logs will be written to") +var backupDirectory = flag.String("backupdir", "", "Directory where backups will be written to") +var enableDebugOptions = flag.Bool("enableDebugFeatures", false, "Enable additional debugging options.") +var enableVerboseLogging = flag.Bool("enableVerboseLogging", false, "Enable additional logging.") +var restoreDatabaseFile = flag.String("restoreDatabase", "", "Restore an Owncast database backup") +var newStreamKey = flag.String("streamkey", "", "Set your stream key/admin password") +var webServerPortOverride = flag.String("webserverport", "", "Force the web server to listen on a specific port") +var webServerIPOverride = flag.String("webserverip", "", "Force web server to listen on this IP address") +var rtmpPortOverride = flag.Int("rtmpport", 0, "Set listen port for the RTMP server") +func main() { flag.Parse() if *logDirectory != "" { @@ -84,11 +88,6 @@ func main() { } func handleCommandLineFlags() { - newStreamKey := flag.String("streamkey", "", "Set your stream key/admin password") - webServerPortOverride := flag.String("webserverport", "", "Force the web server to listen on a specific port") - webServerIPOverride := flag.String("webserverip", "", "Force web server to listen on this IP address") - rtmpPortOverride := flag.Int("rtmpport", 0, "Set listen port for the RTMP server") - if *newStreamKey != "" { if err := data.SetStreamKey(*newStreamKey); err != nil { log.Errorln("Error setting your stream key.", err)