Addr instead of port as flag, default to localhost only
This commit is contained in:
		@@ -12,7 +12,7 @@ import (
 | 
				
			|||||||
	"path"
 | 
						"path"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var port = flag.Int("port", 12345, "port to listen to")
 | 
					var addr = flag.String("addr", "tcp://127.0.0.1:12345", "zeromq address to listen to")
 | 
				
			||||||
var db = flag.String("db", fmt.Sprintf(".%cevents", os.PathSeparator), "path for storage")
 | 
					var db = flag.String("db", fmt.Sprintf(".%cevents", os.PathSeparator), "path for storage")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Serializer struct {}
 | 
					type Serializer struct {}
 | 
				
			||||||
@@ -65,7 +65,7 @@ func main() {
 | 
				
			|||||||
		storagePath = path.Join(wd, storagePath)
 | 
							storagePath = path.Join(wd, storagePath)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fmt.Println("Listening on port:", *port)
 | 
						fmt.Println("Listening on:", *addr)
 | 
				
			||||||
	fmt.Println("Storage path:", storagePath)
 | 
						fmt.Println("Storage path:", storagePath)
 | 
				
			||||||
	goes.SetStorage(goes.NewReadableDiskStorage(storagePath))
 | 
						goes.SetStorage(goes.NewReadableDiskStorage(storagePath))
 | 
				
			||||||
	goes.SetSerializer(NewSerializer())
 | 
						goes.SetSerializer(NewSerializer())
 | 
				
			||||||
@@ -82,8 +82,7 @@ func main() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	defer replySocket.Close()
 | 
						defer replySocket.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	listenAddr := fmt.Sprintf("tcp://*:%d", *port)
 | 
						err = replySocket.Bind(*addr)
 | 
				
			||||||
	err = replySocket.Bind(listenAddr)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		panic(err)
 | 
							panic(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user