mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
34 lines
583 B
Go
34 lines
583 B
Go
package routes
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/spf13/viper"
|
|
"net/http"
|
|
)
|
|
|
|
type SettingBody struct {
|
|
AllowRegister string `json:"allow_register"`
|
|
}
|
|
|
|
func GetVersion(c *gin.Context) {
|
|
version := viper.GetString("version")
|
|
|
|
c.JSON(http.StatusOK, Response{
|
|
Status: "ok",
|
|
Message: "success",
|
|
Data: version,
|
|
})
|
|
}
|
|
|
|
func GetSetting(c *gin.Context) {
|
|
allowRegister := viper.GetString("setting.allowRegister")
|
|
|
|
body := SettingBody{AllowRegister: allowRegister}
|
|
|
|
c.JSON(http.StatusOK, Response{
|
|
Status: "ok",
|
|
Message: "success",
|
|
Data: body,
|
|
})
|
|
}
|