ddns/ddns.go

38 lines
692 B
Go
Raw Normal View History

package main
import (
"github.com/pboehm/ddns/backend"
"github.com/pboehm/ddns/frontend"
"github.com/pboehm/ddns/shared"
2017-12-03 23:07:13 +01:00
"golang.org/x/sync/errgroup"
"log"
)
var serviceConfig *shared.Config = &shared.Config{}
func init() {
serviceConfig.Initialize()
2014-07-15 21:48:15 +02:00
}
func main() {
serviceConfig.Validate()
redis := shared.NewRedisBackend(serviceConfig)
defer redis.Close()
2017-12-03 23:07:13 +01:00
var group errgroup.Group
group.Go(func() error {
lookup := backend.NewHostLookup(serviceConfig, redis)
return backend.NewBackend(serviceConfig, lookup).Run()
})
2017-12-03 23:07:13 +01:00
group.Go(func() error {
return frontend.NewFrontend(serviceConfig, redis).Run()
})
if err := group.Wait(); err != nil {
log.Fatal(err)
}
}