Split out cli arg handling from main
This commit is contained in:
parent
a40312d733
commit
cd15661f08
31
main.go
31
main.go
@ -23,10 +23,6 @@ func main() {
|
|||||||
enableDebugOptions := flag.Bool("enableDebugFeatures", false, "Enable additional debugging options.")
|
enableDebugOptions := flag.Bool("enableDebugFeatures", false, "Enable additional debugging options.")
|
||||||
enableVerboseLogging := flag.Bool("enableVerboseLogging", false, "Enable additional logging.")
|
enableVerboseLogging := flag.Bool("enableVerboseLogging", false, "Enable additional logging.")
|
||||||
restoreDatabaseFile := flag.String("restoreDatabase", "", "Restore an Owncast database backup")
|
restoreDatabaseFile := flag.String("restoreDatabase", "", "Restore an Owncast database backup")
|
||||||
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")
|
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@ -75,6 +71,24 @@ func main() {
|
|||||||
log.Fatalln("failed to open database", err)
|
log.Fatalln("failed to open database", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleCommandLineFlags()
|
||||||
|
|
||||||
|
// starts the core
|
||||||
|
if err := core.Start(); err != nil {
|
||||||
|
log.Fatalln("failed to start the core package", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := router.Start(); err != nil {
|
||||||
|
log.Fatalln("failed to start/run the router", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 *newStreamKey != "" {
|
||||||
if err := data.SetStreamKey(*newStreamKey); err != nil {
|
if err := data.SetStreamKey(*newStreamKey); err != nil {
|
||||||
log.Errorln("Error setting your stream key.", err)
|
log.Errorln("Error setting your stream key.", err)
|
||||||
@ -115,15 +129,6 @@ func main() {
|
|||||||
log.Errorln(err)
|
log.Errorln(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// starts the core
|
|
||||||
if err := core.Start(); err != nil {
|
|
||||||
log.Fatalln("failed to start the core package", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := router.Start(); err != nil {
|
|
||||||
log.Fatalln("failed to start/run the router", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func configureLogging(enableDebugFeatures bool, enableVerboseLogging bool) {
|
func configureLogging(enableDebugFeatures bool, enableVerboseLogging bool) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user