-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
52 lines (47 loc) · 1.72 KB
/
main.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//This file is part of CFDNSUpdater.
//
// CFDNSUpdater is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// CFDNSUpdater is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with CFDNSUpdater. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"github.com/aacebedo/cfdnsupdater/src/utils"
"github.com/aacebedo/cfdnsupdater/src/configuration"
"github.com/aacebedo/cfdnsupdater/src/updater"
"os"
"sync"
"github.com/op/go-logging"
)
var logger = logging.MustGetLogger("cfdnsupdater")
func main() {
var cmdLine configuration.CommandLine
config,err := cmdLine.ParseParameters(os.Args[1:])
if(err != nil) {
logger.Fatalf(err.Error())
}
err = utils.InitLoggers(config.Verbose, config.Quiet, config.LoggingMode)
if(err != nil) {
logger.Fatalf(err.Error())
}
var wg sync.WaitGroup
wg.Add(len(config.DomainConfigs))
for domain, domainConfig := range config.DomainConfigs {
updater := updater.NewDomainUpdater(domain,
domainConfig.Email,
domainConfig.ApiKey,
domainConfig.RecordTypes,
domainConfig.RecordNames,
domainConfig.Period)
go updater.Run(&wg)
}
wg.Wait()
}