|
|
|
@ -40,7 +40,7 @@ func main() {
|
|
|
|
|
app.Name = "update-dns"
|
|
|
|
|
app.Usage = "update dns using dnsimple with public ip address"
|
|
|
|
|
app.UsageText = "update-dns [options] host"
|
|
|
|
|
app.Version = "0.2.1"
|
|
|
|
|
app.Version = "0.3.0-dev"
|
|
|
|
|
app.Action = action
|
|
|
|
|
app.HideHelp = true
|
|
|
|
|
|
|
|
|
@ -58,6 +58,12 @@ func main() {
|
|
|
|
|
Usage: "type of dns record to create",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
cli.IntFlag{
|
|
|
|
|
Name: "ttl",
|
|
|
|
|
Value: 600,
|
|
|
|
|
Usage: "time to live in seconds for dns record",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
cli.StringFlag{
|
|
|
|
|
Name: "content",
|
|
|
|
|
Value: "",
|
|
|
|
@ -100,6 +106,7 @@ func action(context *cli.Context) error {
|
|
|
|
|
|
|
|
|
|
host := context.Args().Get(0)
|
|
|
|
|
kind := context.Generic("type").(*typeFlag).value
|
|
|
|
|
ttl := context.Int("ttl")
|
|
|
|
|
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
ipClient := &ip.Client{
|
|
|
|
@ -167,7 +174,8 @@ func action(context *cli.Context) error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := client.CreateRecord(host, dns.Record{Type: kind, Content: content}); err != nil {
|
|
|
|
|
newRecord := dns.Record{Type: kind, Content: content, TTL: ttl}
|
|
|
|
|
if err := client.CreateRecord(host, newRecord); err != nil {
|
|
|
|
|
return errors.Wrap(err, "could not create record")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|