Enable ability to bind to specific ip/hostname

This commit is contained in:
Tobie Morgan Hitchcock 2017-02-09 11:20:23 +00:00
parent a3b9362adb
commit 3ea681ca34
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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.")