2021-08-18 01:00:13 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"flag"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
|
)
|
|
|
|
|
|
2021-08-18 03:01:45 +00:00
|
|
|
const (
|
|
|
|
|
APPNAME = "srv-ijustjump"
|
|
|
|
|
)
|
|
|
|
|
|
2021-08-18 01:00:13 +00:00
|
|
|
func main() {
|
|
|
|
|
cf := flag.String("config", "config.yaml", "file of config")
|
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
|
|
viper.SetConfigFile(*cf)
|
|
|
|
|
if err := viper.ReadInConfig(); err != nil {
|
|
|
|
|
log.WithFields(log.Fields{
|
|
|
|
|
"func": "main",
|
|
|
|
|
}).Errorf("%s", err.Error())
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-18 01:34:51 +00:00
|
|
|
r := gin.Default()
|
|
|
|
|
gin.SetMode(gin.ReleaseMode)
|
2021-08-18 01:00:13 +00:00
|
|
|
SetupRouters(r)
|
|
|
|
|
|
2021-08-19 01:52:13 +00:00
|
|
|
log.Fatal(r.Run(viper.GetString("app.host")))
|
2021-08-18 01:00:13 +00:00
|
|
|
}
|