forked from Mr-BeanSir/fusionsms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (32 loc) · 1.06 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"flag"
"fmt"
"fusionsms/config"
"fusionsms/middleware"
"fusionsms/route"
"github.com/gin-gonic/gin"
)
func main() {
flag.StringVar(&config.DatabaseIP, "ip", "localhost", "数据库IP地址(默认本地)")
flag.StringVar(&config.DatabasePort, "port", "3306", "数据库端口(默认3306)")
flag.StringVar(&config.DatabaseName, "name", "fusionsms", "数据库用户名(必填)")
flag.StringVar(&config.DatabaseDbName, "dbname", "fusionsms", "数据库名(必填)")
flag.StringVar(&config.DatabasePassword, "password", "fusionsms", "数据库密码(必填)")
flag.StringVar(&config.Key, "key", "", "短信豆账户Key(必填)")
var h = false
flag.BoolVar(&h, "h", false, "帮助")
flag.Parse()
if h {
flag.Usage()
return
}
//controller.SetBaseValues(config.Key)
//gin.SetMode(gin.ReleaseMode)
service := gin.Default() // 创建engine
middleware.Core(service) // 设置中间件
route.Core(service) // 设置路由
if err := service.Run(":8888"); err != nil {
fmt.Println("启动失败,原因:", err)
}
}