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

Using multiple providers #47

Open kthchew opened 1 year ago

kthchew commented 1 year ago

Is it possible to use multiple providers to update different domains? I tried this config (simplified)

{
    dynamic_dns {
        provider cloudflare {$CLOUDFLARE_API_TOKEN}
        domains {
            main-domain.com
        }
    }

    dynamic_dns {
        provider duckdns {$DUCKDNS_TOKEN}
        domains {
            secondary-domain.com
        }
    }
}

but it seems like only the second dynamic_dns block (for DuckDNS) is functional; main-domain.com is not updated at all.

francislavoie commented 1 year ago

I don't think it is possible right now unfortunately. It would require a restructure of the module config to handle that 😓

As a workaround you could run two instances of Caddy, one actually serving HTTP + ddns for one provider, and the other just taking care of ddns for the other provider with no site blocks.

mholt commented 1 year ago

Huh, interesting. You want two domains from different providers pointed to your machine?

Haven't seen that need yet -- but if it's legitimate we can probably refactor some things.

kthchew commented 1 year ago

As a workaround you could run two instances of Caddy, one actually serving HTTP + ddns for one provider, and the other just taking care of ddns for the other provider with no site blocks.

Thanks for the workaround! That should work for me.

Huh, interesting. You want two domains from different providers pointed to your machine?

Haven't seen that need yet -- but if it's legitimate we can probably refactor some things.

To be honest, if it's too complicated then it may not be worth implementing. In my case, it's more of a temporary solution because I'm migrating my services to a new domain (and using a different provider), and this is meant to be a temporary thing until I can switch my users to the new domain, after which I'll only be using one provider. This isn't really meant to be a long-term setup in my case, so a temporary workaround like @francislavoie described works well for me.

mholt commented 1 year ago

Awesome, good to know. Thanks!

I'll close this for now but we can revisit later if there's a more compelling use case for it.

maxbec commented 2 months ago

I also would like to see this option. I have multiple services running on my server. Some for my private network and some for my little company. That's why i need two domains.

mholt commented 2 months ago

This might be a big change but if someone wants to discuss the changes and submit a PR, I'd be okay with reviewing/discussing it!