mholt / caddy-dynamicdns

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

Feature request: option to only update existing records, not create new. #18

Closed demifiend9 closed 1 year ago

demifiend9 commented 2 years ago

I have only A record on ipv4.example.com and only AAAA record on ipv6.example.com but when I use this module, it creates the missing AAAA and A records for the subdomains which I didn't want.

Maybe something like update_only option which would just update existing records without creating new?

mholt commented 2 years ago

Hm, I think you actually want #6 -- which is probably a better way to frame the problem. (Closing, but feel free to continue discussion if needed.)

demifiend9 commented 2 years ago

Thanks for the reply. Yes, I did look at #6 but the linked PR that is supposed to close it looked like it was only about setting IP version for the entire module. What I wanted was to specify IP version for each domain. Perhaps an easy way to do this would be ability to specify ip sources for each domain. I'd use upnp as source for my ipv4 domains (which is working beautifully) and api6.ipify.org for ipv6 domains. (Btw, how about network interface as an ip source like this? Useful for ipv6 and combined with upnp it'd make this app completely independent from ip lookup websites.)

francislavoie commented 2 years ago

What I wanted was to specify IP version for each domain.

I think that would make the config pretty complicated, and would be a breaking change in the config to make it possible.

Feel free to write an alternate PR to mine, if you think you have a better solution in mind.

demifiend9 commented 2 years ago

@francislavoie I'm extremely sorry if my reply came off as demanding or disrespectful. I'm no developer and didn't know how complicated or feasible what I suggested is. I'm fine with my current workaround of using caddy to update ipv4 records and another program for ipv6.

francislavoie commented 2 years ago

Sorry, my intent wasn't to be dismissive either, just wanted to clarify that this sort of change isn't necessarily "easy".

For a change not to be breaking, only new config surface would need to be added, and no changes. Right now since the domains are list of strings, there's no way to configure options per domain.

We could have a separate, new config property that would be per-domain config, but then you'd probably be duplicating the domain in the config (domain written in two places just for ddns then once more for your actual site you're serving). That's not really elegant.

But yeah, a workaround would be to run two instances of Caddy, with the second not accepting any requests, just dealing with ddns for IPv6 or something.

mholt commented 2 years ago

(FWIW I don't mind having breaking changes in this module at this point, it's still early days.)

francislavoie commented 2 years ago

I'll work on implementing update_only after #16 is merged

musklor commented 2 years ago

Hi, thanks for your module. Any news about this issue? I use the ovh services but I have a new entry each time (redirection) each time IP is changed

mholt commented 2 years ago

@musklor It shouldn't be creating a new record every time. That might be a bug in the OVH libdns implementation.

musklor commented 2 years ago

Do you think I can mix DNS ovh and dynamic DNS? Do you think I can use ovh dyndns (login/password) with your module? For the moment I use your module with api credentials.

mholt commented 2 years ago

I don't know anything about OVH, sorry :(

I'd recommend filing a question or issue here: https://github.com/libdns/ovh

musklor commented 2 years ago

I use your module and the ovh DNS module. Can I mix both in the Caddyfile? (For the moment, it's separate. And I use my api credentials twice)

New file (1).txt

francislavoie commented 2 years ago

Please use markdown code blocks when posting your config. It's extremely difficult to follow because the formatting/indentation is lost.