mirror of
https://github.com/Cernobor/oko-server.git
synced 2025-02-24 08:27:17 +00:00
* API endpoint * dockerfile adds commit hash and build time during build
This commit is contained in:
@@ -2,6 +2,7 @@ package server
|
||||
|
||||
const (
|
||||
URIPing = "/ping"
|
||||
URIBuildInfo = "/build-info"
|
||||
URIHardFail = "/hard-fail"
|
||||
URISoftFail = "/soft-fail"
|
||||
URIReinit = "/reinit"
|
||||
|
||||
@@ -81,6 +81,12 @@ func (s *Server) setupRouter() *gin.Engine {
|
||||
router.GET(URIPing, func(gc *gin.Context) {
|
||||
gc.Status(http.StatusNoContent)
|
||||
})
|
||||
router.GET(URIBuildInfo, func(gc *gin.Context) {
|
||||
gc.JSON(http.StatusOK, models.BuildInfo{
|
||||
VersionHash: s.config.VersionHash,
|
||||
BuildTime: s.config.BuildTime,
|
||||
})
|
||||
})
|
||||
router.GET(URIHardFail, func(gc *gin.Context) {
|
||||
gc.Status(http.StatusNotImplemented)
|
||||
})
|
||||
|
||||
@@ -35,6 +35,8 @@ type Server struct {
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
VersionHash string
|
||||
BuildTime *time.Time
|
||||
Port int
|
||||
DbPath string
|
||||
TilepackPath string
|
||||
|
||||
Reference in New Issue
Block a user