Caddy fails to validate (Porkbun API + DNS challenge)

1. Caddy version:

v2.6.4

2. How I installed, and run Caddy:

I run Caddy with the provided systemd package on Archlinux, however I rebuilt the binary so it would have the dns.providers.porkbun plugin and moved that binary into the /usr/bin with appropriate permissions.

a. System environment:

Already answered.

b. Command:

caddy validate Caddyfile

c. Service/unit/compose file:

The systemd service file has not been touched, and that service runs fine if I’m not trying to use Porkbun and a custom binary.

d. My Caddy config:

{ # Global Options
  email <my real email here>
  log {
    output file /var/log/caddy/caddy.log {
      roll_size 10MiB
      roll_keep 5
      roll_gzip 
    }
    level info
  }
}

azimuth.place {
  reverse_proxy localhost:4000
  tls {
    on_demand
    dns porkbun {
      api_key {env.PORKBUN_API_KEY}
      api_secret {env.PORKBUN_API_SECRET}
    }
  }
}

Full file here, but serious doubt the rest of it is relevant.

3. The problem I’m having:

File fails to validate.

4. Error messages and/or full log output:

INFO  using adjacent Caddyfile
Error: adapting config using caddyfile: parsing caddyfile tokens for 'tls': Caddyfile:25 - Error during parsing: Wrong argument count or unexpected line ending after 'api_secret'

5. What I already tried:

Well, I tried both Google and ChatGPT.

6. Links to relevant resources:

I got nothing, except this community?

Worst case scenario I open port 80 and forget about using DNS-01

I had the config wrong, the line is supposed to say ‘api_secret_key’ and env.PORKBUN_API_SECRET_KEY

FYI, you don’t need on_demand if you only have one domain. It’s meant to be used in situations where you don’t know the domains ahead of time in your config. It comes with some risk.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.