ref: 60118973dc6bd7470068a02fdbe5d1dbd466f1db
server/service-rest.go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
/** * Yats - yats * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Paolo Lulli <kevwe.com> * @copyright Paolo Lulli 2024 */ package main import ( "yats-server/config" "yats-server/rest" "github.com/gin-gonic/gin" ) func RestService(c config.Configuration) { // session = DB address := c.REST_ADDRESS router := gin.Default() router.Use(CorsHeaders()) router.SetTrustedProxies([]string{"127.0.0.1"}) gin.SetMode(gin.ReleaseMode) router.POST("/rt/metric", rest.WriteMetricNow) router.POST("/metric", rest.WriteMetricAt) router.POST("/rt/event", rest.WriteEventNow) router.POST("/event", rest.WriteEventcAt) router.Run(address) //router.RunTLS(address, c.CertFile, c.KeyFile) } |