Persist both Caddyfile and editions made by API calls

1. The problem I’m having:

I’m trying to both maintain a single Caddyfile and also any additions made from the API call additions.

It works straight away with no configuration if i’m using caddy-api as it has the persist enabled.

However, if at any given point I want to do a caddy reload because I changed the Caddyfile my additions from the API requests will be gone as I understand because it just loads the Caddyfile.

My question is, how do I update the Caddyfile without the changes from API calls being lost?

2. Error messages and/or full log output:

No errors.

3. Caddy version:

v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=

4. How I installed and ran Caddy:

a. System environment:

Through it’s automatic systemd configuration.

Had to disable caddy and enable caddy-api though.

b. Command:

systemctl start caddy-api

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

5. Links to relevant resources:

Unfortunately, that’s not a thing. Either you only use the Caddyfile, or you go all-in on JSON config via the API.

The Caddyfile adapter is a one-way conversion to JSON, there’s no way to go from JSON back to Caddyfile.

Why do you need this? :thinking: Like why maintain two versions of your config? Which one is the source of truth?

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