Supervisor multi-environment un work for Caddy

Today I tried to add tls.dns.cloudflare plugin for Caddy.
I get an error after I reinstall Caddy.

Error during parsing: Setting up DNS provider ‘cloudflare’: cloudflare: some credentials information are missing: CLOUDFLARE_EMAIL,CLOUDFLARE_API_KEY

Then I realized that I forgot to modify the related configuration of Supervisor.
Later I added 2 environment variables to the Supervisor configuration file, like this.

environment=CADDYPATH="/etc/caddy/ssl",CLOUDFLARE_EMAIL=“myEmail”,CLOUDFLARE_API_KEY=“myAPI”

(“myEmail” and “myAPI” means my real email and api in file, here write it for hide that)

And reload by supervisorctl reread.
Then I run supervisorctl start caddy for running Caddy. It still got that error.

I found another way to config tls.dns.cloudflare plugin is on Caddyfile, like this

tls {
    dns cloudflare myEmail myAPI
}

but it got another error

Error during parsing: Wrong argument count or unexpected line ending after ‘myAPI’

How can I config that environments by supervisor for Caddy?

Hi @candura,

The latter method unfortunately doesn’t work. The Cloudflare DNS plugin code technically can accept those two extra parameters, but the Caddyfile parser itself does not (presumably because not all DNS plugins accept those two extra parameters).

I’m not that familiar with supervisord, but quickly looking over their docs, it looks like your environment method matches the way they say to do it. I’m not sure why Caddy wouldn’t have been able to see the variables.

You could try altering the command itself to something like:

env CADDYPATH="/etc/caddy/ssl" CLOUDFLARE_EMAIL=“myEmail” CLOUDFLARE_API_KEY=“myAPI” caddy

In case it’s part of the problem, it looks like the two Cloudflare values are wrapped in real, angled speech marks. I think they should probably be the straight inch marks usually used in commands and code: "

1 Like