diff --git a/pkg/api/controller/controller.go b/pkg/api/controller/controller.go index 7fa6f15..80d92a5 100644 --- a/pkg/api/controller/controller.go +++ b/pkg/api/controller/controller.go @@ -27,15 +27,18 @@ func (c *Controller) GetEngine() *gin.Engine { } func (c *Controller) SetupRoutes() { - c.setupHealthRoutes() + c.setupCoreRoutes() c.setupContainerRoutes() c.setupMemoryRoutes() c.setupCpuRoutes() } -func (c *Controller) setupHealthRoutes() { - c.ginE.GET("/api/health", func(c *gin.Context) { - c.String(200, "ok") +func (c *Controller) setupCoreRoutes() { + c.ginE.GET("/api/health", func(ctx *gin.Context) { + ctx.String(200, "ok") + }) + c.ginE.GET("/api/version", func(ctx *gin.Context) { + ctx.String(200, c.config.Version) }) } @@ -43,28 +46,28 @@ func (c *Controller) setupHealthRoutes() { func (c *Controller) SetupDebugRoutes() { c.setupDebugRoutes() debugGroup := c.ginE.Group("/debug") - debugGroup.GET("/pprof", func(c *gin.Context) { - pprof.Index(c.Writer, c.Request) + debugGroup.GET("/pprof", func(ctx *gin.Context) { + pprof.Index(ctx.Writer, ctx.Request) }) - debugGroup.GET("/cmdline", func(c *gin.Context) { - pprof.Cmdline(c.Writer, c.Request) + debugGroup.GET("/cmdline", func(ctx *gin.Context) { + pprof.Cmdline(ctx.Writer, ctx.Request) }) - debugGroup.GET("/profile", func(c *gin.Context) { - pprof.Profile(c.Writer, c.Request) + debugGroup.GET("/profile", func(ctx *gin.Context) { + pprof.Profile(ctx.Writer, ctx.Request) }) - debugGroup.GET("/symbol", func(c *gin.Context) { - pprof.Symbol(c.Writer, c.Request) + debugGroup.GET("/symbol", func(ctx *gin.Context) { + pprof.Symbol(ctx.Writer, ctx.Request) }) - debugGroup.GET("/trace", func(c *gin.Context) { - pprof.Trace(c.Writer, c.Request) + debugGroup.GET("/trace", func(ctx *gin.Context) { + pprof.Trace(ctx.Writer, ctx.Request) }) - debugGroup.GET("/heap", func(c *gin.Context) { - pprof.Handler("heap").ServeHTTP(c.Writer, c.Request) + debugGroup.GET("/heap", func(ctx *gin.Context) { + pprof.Handler("heap").ServeHTTP(ctx.Writer, ctx.Request) }) - debugGroup.GET("/goroutine", func(c *gin.Context) { - pprof.Handler("goroutine").ServeHTTP(c.Writer, c.Request) + debugGroup.GET("/goroutine", func(ctx *gin.Context) { + pprof.Handler("goroutine").ServeHTTP(ctx.Writer, ctx.Request) }) - debugGroup.GET("/block", func(c *gin.Context) { - pprof.Handler("block").ServeHTTP(c.Writer, c.Request) + debugGroup.GET("/block", func(ctx *gin.Context) { + pprof.Handler("block").ServeHTTP(ctx.Writer, ctx.Request) }) } diff --git a/pkg/config/config.go b/pkg/config/config.go index 7d0a883..46b5874 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,6 +1,9 @@ package config +const Version = "0.0.14" + type Config struct { + Version string Debug bool RefreshRateSeconds int PushEnabled bool @@ -17,6 +20,7 @@ type Config struct { func NewDefaultConfig() *Config { return &Config{ + Version: Version, Debug: false, RefreshRateSeconds: 5, PushEnabled: true,