Open crunchingcode opened 3 months ago
Hey @crunchingcode, thank you for your question, and apologies for the delayed response.
The current version of the script is designed to be as simple as possible, supporting only one domain configuration out of the box. However, as you mentioned, in a containerized environment, you can utilize Kubernetes CronJobs/Pods to handle multiple domains. You can achieve this by creating multiple CronJob/Pod resources, each configured with its own set of environment variables to correspond to different domain records.
To extend the script’s flexibility, we could modify it to accept command-line arguments, allowing these parameters to override the environment variables. This would enable you to use a crontab-like setup to serve different URLs with a single script and environment. For example, adding command-line arguments for ZONE_ID (z), RECORD_ID (r), and NAME (n) would let you specify these values directly in the crontab definition, making the script versatile for various configurations without needing to create separate jobs for each domain.
two different domains as cronjobs in the crontab file could then look like this:
*/5 * * * * /path/to/cloudflare-ddns.sh -z "zone_id_1" -r "record_id_1" -n "example1.com"
*/5 * * * * /path/to/cloudflare-ddns.sh -z "zone_id_2" -r "record_id_2" -n "example2.com"
Curious. I'm looking at doing multiple records and multiple domains. I can great more pods/crons for each domain and/or record. I tried looping it doing it in one cron/pod but that didn't work. it only did the last domain. Is this functionality supported and I'm just clueless? Which is totally possible.