Chicken and Egg Problem with json config

I have an initial caddy.json config file that I have edited manually to insert an @id. I start caddy with caddy run --config=/etc/caddy/caddy.json. This works fine, I am able to use the @id token.

When I restart my caddy, I lose all of the modifications to the config via the api. So after reading the docs, I need to use the caddy-api.service file so that it will persist the changes I make to disk, so that on a restart we don’t lose the changes.

However, it won’t allow me to load the initial caddy.json file. I changed the .service file to this. ExecStart=/usr/bin/caddy run --environ --resume --config=/etc/caddy/caddy.json

I am not sure how to make this work. Any suggestions would be very appreciated.

I was able to edit the autosave file in /var/lib with my initial @id’s to make it work.

Brad

That’s the wrong approach because Caddy will overwrite it when its config is changed via the API. You’re supposed to use the caddy-api.service unit.

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