mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: remove unix socket if exists (#220)
This commit is contained in:
parent
24b8ff6381
commit
fecc8b3b5f
7
main.go
7
main.go
@ -268,6 +268,13 @@ func listen(handler http.Handler) {
|
||||
|
||||
// UNIX domain socket
|
||||
if config.Server.ListenSocket != "" {
|
||||
// Remove if exists
|
||||
if _, err := os.Stat(config.Server.ListenSocket); err == nil {
|
||||
logbuch.Info("--> Removing unix socket %s", config.Server.ListenSocket)
|
||||
if err := os.Remove(config.Server.ListenSocket); err != nil {
|
||||
logbuch.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
sSocket = &http.Server{
|
||||
Handler: handler,
|
||||
ReadTimeout: time.Duration(config.Server.TimeoutSec) * time.Second,
|
||||
|
Loading…
Reference in New Issue
Block a user