Skip to content

Commit

Permalink
chore: Add sub-params for desactivate auto open browser (#468)
Browse files Browse the repository at this point in the history
chore: Add posibility for desactivate open browser
  • Loading branch information
flemzord committed Oct 12, 2023
1 parent 644091f commit 0a8144b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
storageCacheFlag = "storage.cache"
serverHttpBindAddressFlag = "server.http.bind_address"
uiHttpBindAddressFlag = "ui.http.bind_address"
uiBrowserFlag = "ui.browser"
lockStrategyFlag = "lock-strategy"
lockStrategyRedisUrlFlag = "lock-strategy-redis-url"
lockStrategyRedisDurationFlag = "lock-strategy-redis-duration"
Expand Down Expand Up @@ -131,6 +132,7 @@ func NewRootCommand() *cobra.Command {
}
root.PersistentFlags().String(serverHttpBindAddressFlag, "localhost:3068", "API bind address")
root.PersistentFlags().String(uiHttpBindAddressFlag, "localhost:3068", "UI bind address")
root.PersistentFlags().Bool(uiBrowserFlag, true, "UI Open browser")
root.PersistentFlags().String(lockStrategyFlag, "memory", "Lock strategy (memory, none, redis)")
root.PersistentFlags().String(lockStrategyRedisUrlFlag, "", "Redis url when using redis locking strategy")
root.PersistentFlags().Duration(lockStrategyRedisDurationFlag, redis.DefaultLockDuration, "Lock duration")
Expand Down
4 changes: 3 additions & 1 deletion cmd/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ var UICmd = &cobra.Command{
handler.ServeHTTP(rw, r)
})

openuri(addr)
if viper.GetBool(uiBrowserFlag) {
openuri(addr)
}
fmt.Printf("Numary control is live on http://%s\n", addr)

httpErr := http.ListenAndServe(addr, nil)
Expand Down

0 comments on commit 0a8144b

Please sign in to comment.