Switch caddy to use json configuration

This commit is contained in:
Marty Oehme 2021-07-31 17:26:06 +02:00
parent bebdf72b19
commit 79c704c1f9
Signed by: Marty
GPG key ID: B7538B8F50A1C800
6 changed files with 86 additions and 34 deletions

View file

@ -1,29 +0,0 @@
{
{%- if caddy_email is not undefined and not none %}
email "{{ caddy_email }}"
{% endif %}
{% if caddy_tls_use_staging is sameas true %}
acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
{% endif %}
{% if caddy_use_debug is sameas true %}
debug
{% endif %}
{% if caddy_use_api is sameas false %}
admin off
{% endif %}
{% if caddy_use_https is sameas false %}
auto_https off
{% endif %}
}
{% if caddy_create_test_file_server is sameas true %}
:80 {
file_server {
browse
}
}
{% endif %}

View file

@ -0,0 +1,79 @@
{
{% if caddy_use_api is sameas false %}
"admin": {
"disabled": true
},
{% endif %}
{% if caddy_use_debug is sameas true %}
"logging": {
"logs": {
"default": {
"level": "DEBUG"
}
}
},
{% endif %}
"apps": {
"http": {
"servers": {
"{{ caddy_http_server_name }}": {
"listen": [
":80"
],
"routes": []
{% if caddy_use_https is sameas true %},
"automatic_https": {
"disable": true
}
{% endif %}
},
"{{ caddy_https_server_name }}": {
"listen": [
":443"
],
"routes": []
{% if caddy_use_https is sameas true %},
"automatic_https": {
"disable": true
}
{% endif %}
}
}
}
{% if caddy_use_https is sameas true %},
"tls": {
"automation": {
"policies": [
{
"subjects": [],
"issuers": [
{% if caddy_tls_use_staging is sameas true %}
{
"ca": "https://acme-staging-v02.api.letsencrypt.org/directory",
{%- if caddy_email is not undefined and not none %}
"email": "{{ caddy_email }}",
{% endif %}
"module": "acme"
}
{% else %}
{
{%- if caddy_email is not undefined and not none %}
"email": "{{ caddy_email }}",
{% endif %}
"module": "acme"
},
{
{%- if caddy_email is not undefined and not none %}
"email": "{{ caddy_email }}",
{% endif %}
"module": "zerossl"
}
{% endif %}
]
}
]
}
}
{% endif %}
}
}

View file

@ -3,6 +3,7 @@ version: "3.7"
services:
app:
image: caddy:{{ caddy_version }}
command: caddy run --config /etc/caddy/config.json
ports:
- "80:80"
- "443:443"