Skip to content

Commit 200d4b4

Browse files
authored
Add ip flag to daemon command (#1651)
1 parent 47c634b commit 200d4b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cli/daemon/daemon.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import (
4444

4545
var (
4646
tr = i18n.Tr
47+
ip string
4748
daemonize bool
4849
debug bool
4950
debugFilters []string
@@ -59,6 +60,7 @@ func NewCommand() *cobra.Command {
5960
Args: cobra.NoArgs,
6061
Run: runDaemonCommand,
6162
}
63+
daemonCommand.PersistentFlags().StringVar(&ip, "ip", "127.0.0.1", tr("The IP address the daemon will listen to"))
6264
daemonCommand.PersistentFlags().String("port", "", tr("The TCP port the daemon will listen to"))
6365
configuration.Settings.BindPFlag("daemon.port", daemonCommand.PersistentFlags().Lookup("port"))
6466
daemonCommand.Flags().BoolVar(&daemonize, "daemonize", false, tr("Do not terminate daemon process if the parent process dies"))
@@ -112,7 +114,6 @@ func runDaemonCommand(cmd *cobra.Command, args []string) {
112114
}()
113115
}
114116

115-
ip := "127.0.0.1"
116117
lis, err := net.Listen("tcp", fmt.Sprintf("%s:%s", ip, port))
117118
if err != nil {
118119
// Invalid port, such as "Foo"

0 commit comments

Comments
 (0)