Varakh
1fc3818d3c
All checks were successful
/ build (push) Successful in 5m3s
- Switched to enforce JSON as Content-Type for all incoming requests - Switched to properly respond with JSON on page not found or method not allowed - Renamed CORS_ALLOW_ORIGIN to CORS_ALLOW_ORIGINS - Added CORS_ALLOW_CREDENTIALS which defaults to true - Added CORS_EXPOSE_HEADERS which defaults to * - Overhauled package visibility for server module
23 lines
433 B
Go
23 lines
433 B
Go
package server
|
|
|
|
import (
|
|
"git.myservermanager.com/varakh/upda/api"
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
)
|
|
|
|
type infoHandler struct {
|
|
appConfig appConfig
|
|
}
|
|
|
|
func newInfoHandler(a *appConfig) *infoHandler {
|
|
return &infoHandler{appConfig: *a}
|
|
}
|
|
|
|
func (h *infoHandler) show(c *gin.Context) {
|
|
c.JSON(http.StatusOK, api.DataResponse{Data: gin.H{
|
|
"name": name,
|
|
"version": version,
|
|
"timeZone": h.appConfig.timeZone,
|
|
}})
|
|
}
|