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 to give fixed ip source or set ip source via env #11

Closed manishiitg closed 3 years ago

manishiitg commented 3 years ago

i am using gcp and dynamically creating instances. the ip is already known to me and i can set it in a config file during startup script.

can there be an option so the ipsource doesn't lookup rather reads from a static file?

mholt commented 3 years ago

Sure, IP source modules can return the IP from anywhere. Feel free to implement one and register it on the Caddy website.

francislavoie commented 3 years ago

To clarify, you can write your own IP source plugin:

https://caddyserver.com/docs/json/apps/dynamic_dns/ip_sources/

It just needs to be a Caddy module under the dynamic_dns.ip_sources namespace which implements this interface: https://github.com/mholt/caddy-dynamicdns/blob/master/ipsource.go#L24-L26

See https://caddyserver.com/docs/extending-caddy for an explainer on how to write plugins for Caddy.