3 Star 16 Fork 3

xuh/经纬城市大脑边云计算平台

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 748 Bytes
一键复制 编辑 原始数据 按行查看 历史
sacrex 提交于 3年前 . change http timeout
package main
import (
"net/http"
"strconv"
"time"
"github.com/golang/glog"
"eccgateway/pkg/config"
_ "eccgateway/pkg/db"
"eccgateway/pkg/filter"
"eccgateway/pkg/routers"
"eccgateway/pkg/util"
)
func main() {
port, err := config.GetConfig().Int("httpport")
if err != nil {
glog.Fatalf("can't get port in config")
}
server := &http.Server{
Handler: filter.GeneralFilter(routers.RegisterRouter()),
Addr: ":" + strconv.Itoa(port),
WriteTimeout: 30 * time.Second,
ReadTimeout: 30 * time.Second,
}
if isEnable, _ := config.GetConfig().Bool(config.LeaderElectionEnableKey); isEnable {
go util.StartLeaderElection()
}
glog.Info("Ecc gateway Listen On " + server.Addr)
glog.Fatal(server.ListenAndServe())
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/xuhcoder/eccgateway.git
git@gitee.com:xuhcoder/eccgateway.git
xuhcoder
eccgateway
经纬城市大脑边云计算平台
master

搜索帮助