2019-04-30 14:04:51 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
2019-05-02 03:51:48 +00:00
|
|
|
"fmt"
|
2019-04-30 14:04:51 +00:00
|
|
|
"log"
|
|
|
|
|
|
|
|
"git.trj.tw/golang/go-ddns-svc/module/config"
|
|
|
|
"git.trj.tw/golang/go-ddns-svc/module/option"
|
2019-05-02 03:51:48 +00:00
|
|
|
"git.trj.tw/golang/go-ddns-svc/route/routes"
|
2019-04-30 14:04:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
option.RegOptions()
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var err error
|
|
|
|
opts := option.GetOptions()
|
|
|
|
|
|
|
|
if opts.Help {
|
|
|
|
flag.Usage()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
err = config.LoadConfig(opts.Config)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2019-05-02 03:51:48 +00:00
|
|
|
conf := config.GetConfig()
|
|
|
|
|
|
|
|
engine := routes.NewEngine()
|
|
|
|
routes.SetRoutes()
|
|
|
|
|
|
|
|
engine.Run(fmt.Sprintf(":%d", conf.Port))
|
2019-04-30 14:04:51 +00:00
|
|
|
}
|