From 3ea681ca34e9606c88a4aefc9d24d45929361a91 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Thu, 9 Feb 2017 11:20:23 +0000 Subject: [PATCH] Enable ability to bind to specific ip/hostname --- cli/setup.go | 4 ++-- cli/start.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/setup.go b/cli/setup.go index d9f26899..5b8579d3 100644 --- a/cli/setup.go +++ b/cli/setup.go @@ -207,8 +207,8 @@ func setup() { } // Store the ports in host:port string format - opts.Conn.Web = fmt.Sprintf(":%d", opts.Port.Web) - opts.Conn.Tcp = fmt.Sprintf(":%d", opts.Port.Tcp) + opts.Conn.Web = fmt.Sprintf("%s:%d", opts.Node.Host, opts.Port.Web) + opts.Conn.Tcp = fmt.Sprintf("%s:%d", opts.Node.Host, opts.Port.Tcp) // -------------------------------------------------- // Certs diff --git a/cli/start.go b/cli/start.go index 691e7ede..56f822a2 100644 --- a/cli/start.go +++ b/cli/start.go @@ -84,6 +84,8 @@ func init() { startCmd.PersistentFlags().StringVarP(&opts.DB.Code, "key", "k", "", flag("key")) + startCmd.PersistentFlags().StringVarP(&opts.Node.Host, "bind", "b", "0.0.0.0", "The hostname or ip address to listen for connections on.") + startCmd.PersistentFlags().StringVarP(&opts.Node.Name, "name", "n", host, "The name of this node, used for logs and statistics.") startCmd.PersistentFlags().IntVar(&opts.Port.Tcp, "port-tcp", 33693, "The port on which to serve the tcp server.")