mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 15:44:28 +01:00
added health check endpoint + fixed logging
* set go-gin to release mode * added health check endpoint * excluded endpoint from logger see #63
This commit is contained in:
13
src/main.go
13
src/main.go
@@ -45,7 +45,13 @@ func main() {
|
||||
avatarTmpDir := flag.String("avatar-tmp-dir", "/tmp/", "Avatar tmp directory")
|
||||
flag.Parse()
|
||||
|
||||
router := gin.Default()
|
||||
router := gin.New()
|
||||
router.Use(gin.LoggerWithConfig(gin.LoggerConfig{
|
||||
SkipPaths: []string{"/v1/health"}, //do not log the health requests (to avoid spamming the log file)
|
||||
}))
|
||||
|
||||
router.Use(gin.Recovery())
|
||||
|
||||
log.Info("Started Signal Messenger REST API")
|
||||
|
||||
api := api.NewApi(*signalCliConfig, *attachmentTmpDir, *avatarTmpDir)
|
||||
@@ -56,6 +62,11 @@ func main() {
|
||||
about.GET("", api.About)
|
||||
}
|
||||
|
||||
health := v1.Group("/health")
|
||||
{
|
||||
health.GET("", api.Health)
|
||||
}
|
||||
|
||||
register := v1.Group("/register")
|
||||
{
|
||||
register.POST(":number", api.RegisterNumber)
|
||||
|
||||
Reference in New Issue
Block a user