Initial commit
This commit is contained in:
commit
f57d355631
27 changed files with 1315 additions and 0 deletions
50
cmd/dnsupdater/main.go
Normal file
50
cmd/dnsupdater/main.go
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"dnsupdater/app"
|
||||
)
|
||||
|
||||
func main() {
|
||||
config, err := app.LoadConfig("config.yml")
|
||||
if err != nil {
|
||||
fmt.Println("Failed to load config:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
app, err := app.NewApp(config)
|
||||
if err != nil {
|
||||
fmt.Println("Failed to initialize application:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
for service, domains := range config.Updates {
|
||||
fmt.Println("Service", service)
|
||||
|
||||
// Get service
|
||||
service := app.ProviderManager.Get(service)
|
||||
|
||||
for domain, records := range domains {
|
||||
fmt.Println(" ", "Domain", domain)
|
||||
fmt.Println(" ", "Records")
|
||||
for name, data := range records {
|
||||
|
||||
fmt.Println(" Update: ", name, data)
|
||||
|
||||
ip, err := app.GetIP(data)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
continue
|
||||
}
|
||||
|
||||
err = service.Update(domain, name, ip)
|
||||
if err != nil {
|
||||
fmt.Println("Error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue