aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorEthel Morgan <eth@ethulhu.co.uk>2020-07-07 21:08:36 +0100
committerEthel Morgan <eth@ethulhu.co.uk>2020-07-07 21:08:36 +0100
commitb990b615d88d208d86b45d31271ce974d2290ba0 (patch)
treea9361749a6681a367a5e7ccbf422a72d3e8dcce7 /cmd
parent10f476400508fe147b8746c20913bb02e195146b (diff)
clean up old sockets and chmod new ones
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dispatch/main.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/dispatch/main.go b/cmd/dispatch/main.go
index 032797d..a940584 100644
--- a/cmd/dispatch/main.go
+++ b/cmd/dispatch/main.go
@@ -9,6 +9,7 @@ import (
"context"
"net"
"net/http"
+ "os"
"github.com/gorilla/mux"
"go.eth.moe/dispatch/config"
@@ -45,6 +46,10 @@ func main() {
log.WithError(err).Fatal("could not parse config")
}
+ if listen.Network() == "unix" {
+ _ = os.Remove(listen.String())
+ }
+
log.AddField("http.listen", listen)
conn, err := net.Listen(listen.Network(), listen.String())
if err != nil {
@@ -52,6 +57,10 @@ func main() {
}
defer conn.Close()
+ if listen.Network() == "unix" {
+ _ = os.Chmod(listen.String(), 0660)
+ }
+
m := mux.NewRouter()
m.NotFoundHandler = httputil.NotFoundHandler