fix: dns server is now configurable
This commit is contained in:
parent
62002841db
commit
ce6a837924
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
configs/*
|
configs/*
|
||||||
cmd/tt/tt
|
cmd/dd/dd
|
@ -17,6 +17,7 @@ type Config struct {
|
|||||||
MailSmtpPort string `json:"mail_smtp_port"`
|
MailSmtpPort string `json:"mail_smtp_port"`
|
||||||
DdUsers map[string]map[string]string `json:"dd_users"`
|
DdUsers map[string]map[string]string `json:"dd_users"`
|
||||||
DnsTTL int `json:"dns_ttl"`
|
DnsTTL int `json:"dns_ttl"`
|
||||||
|
DnsServer string `json:"dns_server"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var config Config
|
var config Config
|
||||||
|
@ -58,10 +58,10 @@ func updateDnsRecord(domain string, ip string, hmac string, keyname string, secr
|
|||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
update := fmt.Sprintf(`server 127.0.0.1
|
update := fmt.Sprintf(`server %s
|
||||||
key %s:%s %s
|
key %s:%s %s
|
||||||
update add %s %d a %s
|
update add %s %d a %s
|
||||||
send`, hmac, keyname, secret, domain, config.DnsTTL, ip)
|
send`, config.DnsServer, hmac, keyname, secret, domain, config.DnsTTL, ip)
|
||||||
|
|
||||||
_, err = io.WriteString(f, update)
|
_, err = io.WriteString(f, update)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user