kutzilla / docker-hetzner-ddns

A Docker image that allows you to use Hetzner DNS as a DynDNS Provider
MIT License
22 stars 8 forks source link

Support for wildcars #8

Open punqbund opened 2 years ago

punqbund commented 2 years ago

Please add support for updating wildcard DNS records like *.mydomain.com. This would help me to update the IP address for all subdomains at once.

punqbund commented 2 years ago

Never mind, I got it running by providing the record name as "*" (asterisk surrounded by double quotes). Maybe you should mention it in the documentation.

kutzilla commented 2 years ago

Hey @punqbund,

thank you for your feature request. That's a good point. The default behavior is updating the -Record anyway. The CNAME values should be updated automatically by the -Record. But if i understand you correctly, you would like to update more A- or AAAA-Records, right?

Additionally i could add a parameter to provide multiple subdomains. This makes it explicit. What do you think? This could be helpful for subdomains, that should be not updated.

Cheers, kutzilla

punqbund commented 2 years ago

Hi @kutzilla , right, it's about updating A-records in my case. I want to update both the A-record for mydomain.com and the A-record for *.mydomain.com at the same time. Regarding your idea about an additional parameter to explicitly specify multiple subdomains: I think that makes sense. Maybe you could number the RECORD_NAME parameters:

docker run \
-e ZONE_NAME=example.com \ 
-e HETZNER_API_TOKEN=my-secret-api-token \
-e ZONE_RECORD_TYPE=A \
-e RECORD_NAME "@" \
-e RECORD_NAME1 suba \
-e RECORD_NAME2 subb \
kutzilla/hetzner-dns

Thinking this further, perhaps ZONE_RECORD_TYPE A and AAAA could be supported at the same time using the same principle:

docker run \
-e ZONE_NAME=example.com \ 
-e HETZNER_API_TOKEN=my-secret-api-token \
-e ZONE_RECORD_TYPE=A \
-e RECORD_NAME suba \
-e ZONE_RECORD_TYPE1=AAAA \
-e RECORD_NAME1 subb \
kutzilla/hetzner-ddns
kutzilla commented 2 years ago

Good point. To keep it dynamically, I suggest to define a new environment variable ZONES_CONF to provide a JSON structure to update multiple records. Like this:

{
 "apiToken" : "my-secret-api-token",
 "records" : [
   {
     "recordType" : "A",
     "name" : "example1"
   },
   {
     "recordType" : "A",
     "name" : "example2"
   }
  ]
}

What do you think?

punqbund commented 2 years ago

@kutzilla I think this would be a nice solution.