package main

// {{cookiecutter.app_relative_path}}/{{cookiecutter.app_name}}/

import (
    _ "{{cookiecutter.app_relative_path}}/{{cookiecutter.app_name}}/docs" // docs is generated by Swag CLI, you have to import it.
    "{{cookiecutter.app_relative_path}}/{{cookiecutter.app_name}}/internal/router"
    "{{cookiecutter.app_relative_path}}/{{cookiecutter.app_name}}/internal/service"
    "{{cookiecutter.app_relative_path}}/{{cookiecutter.app_name}}/proto/config"

    "github.com/better-go/pkg/conf"
    "github.com/better-go/pkg/errors"
    "github.com/better-go/pkg/log"
    "github.com/gin-gonic/gin"
)

// @title Push Gateway API Docs
// @version 1.0
// @description 推送网关 API
// @termsOfService http://swagger.io/terms/
// @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
// @host 127.0.0.1:8080
// @BasePath /
func main() {
    // http server:
    r := gin.Default()

    //gin.SetMode()

    // config load:
    var cfg *config.Config

    // 默认路径解析配置:
    errors.PanicError(conf.LoadConfig(&cfg, config.RepoName, config.AppName))
    log.Debugf("current config info: %+v", cfg.HTTP)

    // service:
    srv := service.New(cfg)

    // register api:
    router.RegisterRouter(r, srv)

    // run:
    r.Run(":8080") // listen and serve on 0.0.0.0:8080
}
