fix: catch process termination signal to clear socket file

This commit is contained in:
Hintay 2024-11-07 00:07:30 +09:00 committed by Jacky
parent 45d98f524e
commit e634c75804
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D

View file

@ -10,8 +10,8 @@ import (
"fmt"
"net"
"net/http"
"os"
"os/signal"
"syscall"
"github.com/0xJacky/Nginx-UI/internal/cert"
"github.com/0xJacky/Nginx-UI/internal/cmd"
@ -108,7 +108,7 @@ func main() {
confPath := appCmd.String("config")
settings.Init(confPath)
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer cancel()
err := risefront.New(ctx, risefront.Config{