|
|
@ -41,15 +41,14 @@ import (
|
|
|
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
|
|
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
|
|
|
// @BasePath /
|
|
|
|
// @BasePath /
|
|
|
|
func main() {
|
|
|
|
func main() {
|
|
|
|
fmt.Println("api start ")
|
|
|
|
log.NewPrivateLog(constant.LogFileName)
|
|
|
|
gin.SetMode(gin.ReleaseMode)
|
|
|
|
gin.SetMode(gin.ReleaseMode)
|
|
|
|
f, _ := os.Create("../logs/api.log")
|
|
|
|
f, _ := os.Create("../logs/api.log")
|
|
|
|
gin.DefaultWriter = io.MultiWriter(f)
|
|
|
|
gin.DefaultWriter = io.MultiWriter(f)
|
|
|
|
// gin.SetMode(gin.DebugMode)
|
|
|
|
// gin.SetMode(gin.DebugMode)
|
|
|
|
r := gin.Default()
|
|
|
|
r := gin.Default()
|
|
|
|
r.Use(utils.CorsHandler())
|
|
|
|
r.Use(utils.CorsHandler())
|
|
|
|
fmt.Println("load config: ", config.Config)
|
|
|
|
log.Info("load config: ", config.Config)
|
|
|
|
log.NewPrivateLog(constant.LogFileName)
|
|
|
|
|
|
|
|
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
|
|
|
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
|
|
|
if config.Config.Prometheus.Enable {
|
|
|
|
if config.Config.Prometheus.Enable {
|
|
|
|
r.GET("/metrics", promePkg.PrometheusHandler())
|
|
|
|
r.GET("/metrics", promePkg.PrometheusHandler())
|
|
|
|