Compare commits

...

2 Commits

Author SHA1 Message Date
Rodolfo Campos 5d5773ba71
Merge pull request #114 from rossigee/bind-address-constant
Report same address as used to bind
2021-11-05 13:07:39 +01:00
Ross Golder c959617bf6 Fix for inconsistency between address we bind to and address we say we bind to (refs #113). 2021-10-15 08:29:11 +07:00
1 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,8 @@ import (
"github.com/yosssi/ace"
)
const BindAddress = "0.0.0.0"
var ServePort int
var upgrader = websocket.Upgrader{
@ -94,13 +96,13 @@ func Build(output string, live bool) error {
go func() {
http.Handle("/", http.FileServer(http.Dir(filepath.Join(".", "output"))))
err := http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", ServePort), nil)
err := http.ListenAndServe(fmt.Sprintf("%s:%d", BindAddress, ServePort), nil)
if err != nil {
panic(err)
}
}()
fmt.Printf("Serving content of output/ at http://127.0.0.1:%d (ctrl-c to quit)\n", ServePort)
fmt.Printf("Serving content of output/ at http://%s:%d (ctrl-c to quit)\n", BindAddress, ServePort)
}
// PDF
wg.Add(1)