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
23fc1b62cc
commit
47b9cacb26
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