about summary refs log tree commit diff stats
path: root/cmd/server
diff options
context:
space:
mode:
authorAlan Pearce2024-07-02 11:47:36 +0200
committerAlan Pearce2024-07-02 11:47:36 +0200
commitb22ceb6c830f07061e5e16e1428438b495efe9d6 (patch)
treed84d2cc9c0c58b3ceeb33458f37691473f3457a9 /cmd/server
parenta14e030b41799ea65e026d600ce18a48507bebd0 (diff)
downloadwebsite-b22ceb6c830f07061e5e16e1428438b495efe9d6.tar.lz
website-b22ceb6c830f07061e5e16e1428438b495efe9d6.tar.zst
website-b22ceb6c830f07061e5e16e1428438b495efe9d6.zip
fix inconsistent handling of IPv6 listen address
Diffstat (limited to 'cmd/server')
-rw-r--r--cmd/server/main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go
index ca69ba2..be36e3b 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -6,8 +6,8 @@ import (
 	"os"
 	"os/signal"
 
-	"go.alanpearce.eu/x/log"
 	"go.alanpearce.eu/website/internal/server"
+	"go.alanpearce.eu/x/log"
 
 	"github.com/ardanlabs/conf/v3"
 	"gitlab.com/tozd/go/errors"
@@ -25,6 +25,10 @@ func main() {
 	}
 	log := log.Configure(!runtimeConfig.Development)
 
+	if listenAddress := runtimeConfig.ListenAddress; listenAddress[0] == '[' {
+		runtimeConfig.ListenAddress = listenAddress[1 : len(listenAddress)-1]
+	}
+
 	if runtimeConfig.Development {
 		tmpdir, err := os.MkdirTemp("", "website")
 		if err != nil {