go-ddns-svc/main.go
2019-05-03 17:17:44 +08:00

43 lines
637 B
Go

package main
import (
"flag"
"fmt"
"log"
"git.trj.tw/golang/go-ddns-svc/module/apis/aws"
"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()
err = aws.NewAWS()
if err != nil {
log.Fatal(err)
}
engine := routes.NewEngine()
routes.SetRoutes()
engine.Run(fmt.Sprintf(":%d", conf.Port))
}