1. Caddy version (caddy version
):
2.3.0 but I can upgrade
2. How I run Caddy:
from within docker container
a. System environment:
docker image
b. Command:
CMD ["caddy", "run", "--config", "/etc/caddy/config.json"]
c. Service/unit/compose file:
Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.
d. My complete Caddyfile or JSON config:
{
"storage": { "module": "dynamodb", "table": "CertMagic", "aws_region": "eu-central-1" },
"apps": {
"tls": {
"automation": {
"policies": [
{
"subjects": ["siasky.xyz", "*.siasky.xyz", "*.hns.siasky.xyz"],
"issuers": [
{ "challenges": { "dns": { "provider": { "max_retries": 50, "name": "route53" } } }, "module": "acme" }
]
},
{ "issuers": [{ "module": "internal" }], "on_demand": true }
]
}
}
}
}
3. The problem I’m having:
Is it possible to use environment variable to replace multiple tokens in json config just as I would do in Caddyfile?
I have env variable that is
SSL_CERTIFICATE_STRING=siasky.xyz, *.siasky.xyz, *.hns.siasky.xyz
In Caddyfile you can use {$SSL_CERTIFICATE_STRING} to expand this string into multiple tokens and “subjects” ends up as an array of strings. I can’t find any mention of how to do that from json config though. I need to use json config because I’m also using “storage” module that doesn’t have a directive for Caddyfile.
What I’d like to do is basically sth like
...
"subjects": "{$SSL_CERTIFICATE_STRING}",
...
or
...
"subjects": ["{$SSL_CERTIFICATE_STRING}"],
...
I don’t want to have 3 env variables for each domain though because I want this config to be flexible - some of servers that I’m running have 5 domains, some have 3.