leveldb-demo/main.go

29 lines
493 B
Go
Raw Normal View History

2022-03-23 09:05:30 +00:00
package main
import (
2022-04-01 08:58:03 +00:00
"context"
"os"
"os/signal"
"time"
2022-03-23 09:05:30 +00:00
2022-04-01 08:58:03 +00:00
"github.com/sirupsen/logrus"
"myschools.me/suguo/leveldb-demo/gin"
2022-03-23 09:05:30 +00:00
)
func main() {
2022-04-01 08:58:03 +00:00
gin.Service(&gin.Config{
RootPath: "assets/file",
Addr: "0.0.0.0",
Port: 8080,
2022-03-23 09:05:30 +00:00
})
2022-04-01 08:58:03 +00:00
// 服务停止相应
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
<-c
_, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
logrus.Println("file storage service shutting down")
os.Exit(0)
2022-03-23 09:05:30 +00:00
}