Skip to content

Commit

Permalink
Add arg for HTTP server bind address
Browse files Browse the repository at this point in the history
Eg; `browsh -http-server-bind 127.0.0.1`

Fixes #57
  • Loading branch information
tombh committed Jul 8, 2018
1 parent 26fa4cb commit 160a19e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions interfacer/src/browsh/browsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
IsHTTPServer = flag.Bool("http-server", false, "Run as an HTTP service")
// HTTPServerPort also needs to be exported for use in tests
HTTPServerPort = flag.String("http-server-port", "4333", "HTTP server address")
httpServerBind = flag.String("http-server-bind", "0.0.0.0", "HTTP server binding address")
// IsTesting is used in tests, so it needs to be exported
IsTesting = false
logfile string
Expand Down
2 changes: 1 addition & 1 deletion interfacer/src/browsh/raw_text_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func HTTPServerStart() {
uncompressed := http.HandlerFunc(handleHTTPServerRequest)
limiterMiddleware := setupRateLimiter()
serverMux.Handle("/", limiterMiddleware.Handler(gziphandler.GzipHandler(uncompressed)))
if err := http.ListenAndServe(":" + *HTTPServerPort, &slashFix{serverMux}); err != nil {
if err := http.ListenAndServe(*httpServerBind + ":" + *HTTPServerPort, &slashFix{serverMux}); err != nil {
Shutdown(err)
}
}
Expand Down

0 comments on commit 160a19e

Please sign in to comment.