You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.0 KiB

package main
import (
"dsSupport/Router"
Utils "dsSupport/Utils"
"dsSupport/Utils/CommonUtil"
"dsSupport/Utils/ConfigUtil"
"dsSupport/Utils/FileUtil"
_ "dsSupport/docs"
"fmt"
"github.com/gin-gonic/gin"
ginSwagger "github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
)
// @title 基础数据API
// @version 1.0
// @description 分布式,大并发,高可用
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @tag.name dataaccess
// @tag.description 数据订阅
// @tag.name dataerror
// @tag.description 数据异常
// @tag.name datasource
// @tag.description 数据源
// @tag.name datastatistic
// @tag.description 数据统计
// @tag.name jyt2012
// @tag.description 字典
// @tag.name metadata
// @tag.description 元数据
// @tag.name orgtree
// @tag.description 机构目录
// @tag.name account
// @tag.description 后台登陆
// @host 127.0.0.1:8005
func main() {
// 发布模式
//gin.SetMode(gin.ReleaseMode)
// 开发模式
gin.SetMode(gin.DebugMode)
// 开启gin服务器
r := gin.Default()
// 使用跨域中间件
r.Use(Utils.Cors())
//var casURL = ConfigUtil.SSOCasURL //单点登录地址
//redirectURL, err := url.Parse(casURL)
//if err != nil {
// log.Fatal(err)
// return
//}
//
//casOptions := goCas.Options{
// URL: redirectURL,
// SendService: true,
//}
//r.Use(MiddleWare.MiddlewareFunc(&casOptions))
// 显示Logo
configIniFile := "./Config/logo.txt"
if !CommonUtil.Exists(configIniFile) {
configIniFile = "/usr/local/dsMin/dsSupport/Config/logo.txt"
}
var logo = FileUtil.ReadFileContent(configIniFile)
fmt.Print(logo)
r.Static("/docs", "./docs")
//注册swagger
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
//前台页面目录
r.Static("/dsSupport", "./Html")
//主路由
Router.GinRouter(r)
// 监听并在 0.0.0.0:8002 上启动服务
r.Run(":" + ConfigUtil.ServerPort)
}