cloudflare-ddns icon indicating copy to clipboard operation
cloudflare-ddns copied to clipboard

feat: add multiple zone with same authentication.

Open xuandung38 opened this issue 1 year ago • 0 comments

Currently when you want to add multiple zone_ids with the same authenticator account, you have to repeat many times for example:

{
  "cloudflare": [
    {
      "authentication": {
        "api_token": "api_token_here", // Either api_token or api_key
        "api_key": {
          "api_key": "api_key_here",
          "account_email": "your_email_here"
        }
      },
      "zone_id": "zone_id_1_here",
      "subdomains": [
        {
          "name": "", // Root domain (example.com)
          "proxied": true
        },
      ]
    },
    {
      "authentication": {
        "api_token": "api_token_here", // Either api_token or api_key
        "api_key": {
          "api_key": "api_key_here",
          "account_email": "your_email_here"
        }
      },
      "zone_id": "zone_id_2_here",
      "subdomains": [
        {
          "name": "", // Root domain (example2.com)
          "proxied": true
        },
      ]
    }
  ],
  "a": true,
  "aaaa": true,
  "purgeUnknownRecords": false,
  "ttl": 300
}

Now you just need to declare zones and authentication accounts right in its own object.

Example:

{
  "cloudflare": [
    {
      "authentication": {
        "api_token": "api_token_here",
        "api_key": {
          "api_key": "api_key_here",
          "account_email": "your_email_here"
        }
      },
      "zones": [
        {
          "zone_id": "your_zone_id_1_here",
          "subdomains": [
            {
              "name": "",
              "proxied": false
            },
            {
              "name": "remove_or_replace_with_your_subdomain",
              "proxied": false
            }
          ]
        },
        {
          "zone_id": "your_zone_id_2_here",
          "subdomains": [
            {
              "name": "subdomain1",
              "proxied": true
            },
            {
              "name": "subdomain2",
              "proxied": false
            }
          ]
        }
      ]
    },
  ],
  "a": true,
  "aaaa": true,
  "purgeUnknownRecords": false
}

xuandung38 avatar Jul 02 '23 08:07 xuandung38