all repos — homestead @ 02c4877f0f533ef245801976db811c8f9e9c577e

Code for my website

allow listen address to be configured

Alan Pearce
commit

02c4877f0f533ef245801976db811c8f9e9c577e

parent

7a0df338feddcd4a49fd81fad48aac666e975f65

1 file changed, 3 insertions(+), 1 deletion(-)

changed files
M server.goserver.go
@@ -6,6 +6,7 @@ "errors"
"fmt" "io" "log" + "net" "net/http" "os" "time"
@@ -31,6 +32,7 @@ )
type Config struct { Production bool `conf:"default:false"` + ListenAddress string `conf:"default:localhost"` Port uint16 `conf:"default:3000,short:p"` BaseURL cfg.URL `conf:"default:http://localhost:3000,short:b"` RedirectOtherHostnames bool `conf:"default:false"`
@@ -185,5 +187,5 @@ go func() {
err := metricServer.Listen(":9091") log.Printf("failed to start metrics server: %v", err) }() - log.Fatal(toplevel.Listen(fmt.Sprintf("%s:%d", "", runtimeConfig.Port))) + log.Fatal(toplevel.Listen(net.JoinHostPort(runtimeConfig.ListenAddress, fmt.Sprint(runtimeConfig.Port)))) }