-
-
Save sonots/87972440cd2063504902 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http.ListenAndServe(":8080", m) | |
proto := "unix" | |
addr := "/dev/shm/app.sock" | |
l, e := net.Listen(proto, addr) | |
if e != nil { | |
fmt.Println(e) | |
} | |
//as the daemon is launched as root, change to permission of the socket to allow non-root to connect | |
if proto == "unix" { | |
os.Chmod(addr, 0777) | |
} | |
httpSrv := http.Server{Addr: addr, Handler: m} | |
httpSrv.Serve(l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment