37 lines
530 B
Go
37 lines
530 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
|
|
"git.trj.tw/golang/go-ddns-svc/module/config"
|
|
"git.trj.tw/golang/go-ddns-svc/module/option"
|
|
"git.trj.tw/golang/go-ddns-svc/route/routes"
|
|
)
|
|
|
|
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)
|
|
}
|
|
conf := config.GetConfig()
|
|
|
|
engine := routes.NewEngine()
|
|
routes.SetRoutes()
|
|
|
|
engine.Run(fmt.Sprintf(":%d", conf.Port))
|
|
}
|