lyoshenka/cloudflare-ddns

Multiple domains?

vvdan opened this issue · 4 comments

vvdan commented

Hi,

This may seem silly but I can't seem to add multiple domains.

Im not really great with php/programming but I can't seem to run this for multiple domains, it seems like it's only update the first one.

Here are my settings:

<?php
return array(
  'cloudflare_email' => 'xxxxxxxxxxx@xxxxxxxxx.com',     // the email address yo>
  'cloudflare_api_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',   // your >

  'domain' => ['test1.com'],['test2.com'],             // the name of the domai>
  'record_name' => ['test1.com'],['test2.com'],        // the full name of the >
                                // the record(s) must be part of the domain(s>

  'ttl' => 600,                   // a TTL of 1 means "automatic". if you wan>

  'proxied' => false,           // Whether the record is receiving the perfor>

  'protocol' => 'ipv4',         // what protocol to use to get the ip address>

  'auth_token' => ''            // (optional) if set, enable API mode and req>
                                // generate a random string here:

Am I doing anything wrong?

Kindest regards,
Dan

vvdan commented

Also tried with 'domain' => array('test1.com',''test2.com'),

still updates first one only

Hm, you're correct, that's a limitation of the script. But you can use the updated domain as a CNAME record for the other domains in order to get the same IP there.
Something like this should work:
Screenshot 2020-02-06 at 00 21 38

One way you could go is to make multiple config.php files (one for each domain) and pass the config name to the ddns.php script when you run it. You'd have to make a small change in ddns.php to take the config path as an argument. Would that work for you?

I also like @schliflo's suggestion