timothymiller / cloudflare-ddns

šŸŽ‰šŸŒ©ļø Dynamic DNS (DDNS) service based on Cloudflare! Access your home network remotely via a custom domain name without a static IP!
https://timknowsbest.com/free-dynamic-dns
GNU General Public License v3.0
3.13k stars 329 forks source link

[Need help] Error reading config.json (JSON Validation successfull) #159

Closed synexTG closed 1 year ago

synexTG commented 1 year ago

Hey guys i think i am just oversee something.

I get the message "šŸ˜” Error reading config.json" and i do not know why.

Here is my config.json

{
    "cloudflare": [
        {
            "authentication": {
                "api_token": "apitokenfordnseditthezone"
            },
            "zone_id": "zoneid",
            "subdomains": [
                {
                    "name": "eb",
                    "proxied": false
                },
                {
                    "name": "px",
                    "proxied": false
                },
                {
                    "name": "p",
                    "proxied": false
                },
                {
                    "name": "ha",
                    "proxied": true
                }
            ]
        }
    ],
    "a": true,
    "aaaa": false,
    "purgeUnknownRecords": false,
    "ttl": 300
}

Here is my docker compose service:

  cloudflare-ddns:
    image: timothyjmiller/cloudflare-ddns:latest
    container_name: cloudflare-ddns
    security_opt:
      - no-new-privileges:true
    network_mode: "host"
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - /opt/cloudflare-ddns:/config.json
    restart: unless-stopped

I created the config.json under following path: /opt/cloudflare-ddns/config.json I also tested to set the config.json permission to 777 and verified the json with a validator.

What am i doing wrong here? I am new to docker and i think it is just a small mistake.

tradenet commented 1 year ago

This might be a silly question but did you actually add the zone id "number" you get from cloudflare?

synexTG commented 1 year ago

This might be a silly question but did you actually add the zone id "number" you get from cloudflare?

No problem :) and yes i add the string from the overview: Zone ID from Cloudflare

synexTG commented 1 year ago

I found the problem it was my docker compose - i had to directly give the config.json file in the docker volume section. Like written here in the readme. I dont know why i didnt get this.

This my docker compose yml now:
  cloudflare-ddns:
    image: timothyjmiller/cloudflare-ddns:latest
    container_name: cloudflare-ddns
    security_opt:
      - no-new-privileges:true
    network_mode: "host"
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - /opt/cloudflare-ddns/config.json:/config.json
    restart: unless-stopped

Thank you.