forked from pboehm/ddns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ddns.go
37 lines (28 loc) · 692 Bytes
/
ddns.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"github.com/pboehm/ddns/backend"
"github.com/pboehm/ddns/frontend"
"github.com/pboehm/ddns/shared"
"golang.org/x/sync/errgroup"
"log"
)
var serviceConfig *shared.Config = &shared.Config{}
func init() {
serviceConfig.Initialize()
}
func main() {
serviceConfig.Validate()
redis := shared.NewRedisBackend(serviceConfig)
defer redis.Close()
var group errgroup.Group
group.Go(func() error {
lookup := backend.NewHostLookup(serviceConfig, redis)
return backend.NewBackend(serviceConfig, lookup).Run()
})
group.Go(func() error {
return frontend.NewFrontend(serviceConfig, redis).Run()
})
if err := group.Wait(); err != nil {
log.Fatal(err)
}
}