2014-07-12 22:37:00 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-07-02 22:27:41 +02:00
|
|
|
"github.com/pboehm/ddns/backend"
|
2017-12-03 22:42:25 +01:00
|
|
|
"github.com/pboehm/ddns/frontend"
|
|
|
|
"github.com/pboehm/ddns/shared"
|
2017-12-03 23:07:13 +01:00
|
|
|
"golang.org/x/sync/errgroup"
|
2014-07-12 22:37:00 +02:00
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
2017-12-03 22:42:25 +01:00
|
|
|
var serviceConfig *shared.Config = &shared.Config{}
|
2014-07-14 23:19:47 +02:00
|
|
|
|
2014-07-15 23:12:27 +02:00
|
|
|
func init() {
|
2017-12-03 23:18:47 +01:00
|
|
|
serviceConfig.Initialize()
|
2014-07-15 21:48:15 +02:00
|
|
|
}
|
2014-07-15 19:20:11 +02:00
|
|
|
|
2014-07-15 23:12:27 +02:00
|
|
|
func main() {
|
2017-12-03 23:18:47 +01:00
|
|
|
serviceConfig.Validate()
|
2014-07-15 23:12:27 +02:00
|
|
|
|
2017-12-03 22:42:25 +01:00
|
|
|
redis := shared.NewRedisBackend(serviceConfig)
|
2017-01-29 19:02:14 +01:00
|
|
|
defer redis.Close()
|
2014-07-15 23:12:27 +02:00
|
|
|
|
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-01-29 19:02:14 +01:00
|
|
|
|
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)
|
|
|
|
}
|
2014-07-12 22:37:00 +02:00
|
|
|
}
|