captainVersion: 4
services:
    $$cap_appname:
        image: oznu/cloudflare-ddns:latest
        environment:
            API_KEY: $$cap_api_key
            ZONE: $$cap_zone
            SUBDOMAIN: $$cap_subdomain
            PROXIED: $$cap_proxied
            RRTYPE: $$cap_rrtype
            DNS_SERVER: $$cap_dns_server
            CRON: $$cap_cron
        caproverExtra:
            notExposeAsWebApp: 'true'
caproverOneClickApp:
    variables:
        - id: $$cap_api_key
          label: Cloudflare API token
          defaultValue: ''
          description: Your CloudFlare scoped API token. See the Creating a Cloudflare API token upward.
          validRegex: /.{1,}/
        - id: $$cap_zone
          label: DNS zone
          defaultValue: $$cap_root_domain
          description: The DNS zone that DDNS updates should be applied to. Defaults to your CapRover root domain.
          validRegex: /.{1,}/
        - id: $$cap_subdomain
          label: Zone's subdomain
          defaultValue: '*'
          description: A subdomain of the ZONE to write DNS changes to. If this is not supplied the root zone will be used. Defaults to your CapRover apps subdomains.
        - id: $$cap_proxied
          label: Proxied?
          defaultValue: 'false'
          description: If you are using free ClourFlare tier, leave as false. Set to true to make traffic go through the CloudFlare CDN.
          validRegex: /.{1,}/
        - id: $$cap_rrtype
          label: Resource record type
          defaultValue: 'A'
          description: Set to AAAA to use set IPv6 records instead of IPv4 records. Defaults to A for IPv4 records.
          validRegex: /.{1,}/
        - id: $$cap_dns_server
          label: DNS server
          defaultValue: '1.1.1.1'
          description: Set to the IP address of the DNS server you would like to use. Defaults to 1.1.1.1 (CloudFlare DNS) otherwise.
          validRegex: /.{1,}/
        - id: $$cap_cron
          label: Cron
          defaultValue: '*/5 * * * *'
          description: Sets how often your container checks for IP changes. Defaults to every 5 minutes. You can read more about CRON configuration here https://en.wikipedia.org/wiki/Cron
          validRegex: /.{1,}/
    instructions:
        start: >-
            This small Alpine Linux based Docker image will allow you to use the free CloudFlare DNS Service as a Dynamic DNS Provider (DDNS).

            Default values are tuned to work with CapRover.



            To create a CloudFlare API token for your DNS zone go to https://dash.cloudflare.com/profile/api-tokens and follow these steps:



            1 - Click Create Token



            2 - Provide the token a name, for example, cloudflare-ddns



            3 - Grant the token the following permissions:

            Zone - Zone Settings - Read

            Zone - Zone - Read

            Zone - DNS - Edit



            4 - Set the zone resources to:

            Include - All zones



            5 - Complete the wizard and copy the generated token into the Cloudflare API token field
        end: >-
            Cloudflare DDNS has been successfully deployed.
    displayName: CloudFlare DDNS
    isOfficial: false
    description: This small image will allow you to use the free CloudFlare DNS Service as a Dynamic DNS Provider (DDNS).
    documentation: Taken from https://github.com/oznu/docker-cloudflare-ddns
