mholt / caddy-dynamicdns

Caddy app that keeps your DNS records (A/AAAA) pointed at itself.
Apache License 2.0
236 stars 24 forks source link

Add Caddyfile support as a global option #2

Closed francislavoie closed 3 years ago

francislavoie commented 3 years ago

Closes #1

Caddyfile:

{
    dynamic_dns {
        domain foo.example.com
        provider duckdns my-api-key
        check_interval 5m
    }
}

👇

{
    "apps": {
        "dynamic_dns": {
            "dns_provider": {
                "api_token": "my-api-key",
                "name": "duckdns"
            },
            "domain": "foo.example.com",
            "check_interval": 300000000000
        }
    }
}
MagnuM2K commented 3 years ago

Cool.. Tested and works..
How you add additional A records? Using comma "," to separate each record and does this handle @ A record?

{ dynamic_dns { domain www.site.com provider gandi <APIKEY> check_interval 5m } }

caddy2 | {"level":"info","ts":1614104422.3234785,"logger":"dynamic_dns","msg":"IP address changed","last_ip":"","new_ip":"XX.XX.XX.XX"} caddy2 | {"level":"info","ts":1614104422.3235543,"logger":"dynamic_dns","msg":"updating DNS record","type":"A","name":"www.site.com","value":"XX.XX.XX.XX","ttl":300} caddy2 | {"level":"info","ts":1614104423.0712886,"logger":"dynamic_dns","msg":"finished updating DNS"}

francislavoie commented 3 years ago

There's currently no way to do it for more than one domain, it's a limitation of the existing implementation, doesn't have to do with the Caddyfile adapter. You can open a new issue as a feature request.