I am currently using caddyfile and it is working fine. However I have a need for layer4 which doesn’t support caddyfile.
How do I convert to using json? Right now its using the /etc/caddy/caddyfile?
Also is there an easy caddfyfile to json convertor so that I don’t have to write out what is working in caddyfile to json. I can just add the layer4 items items that I need. I found an online tool but looks like it hasn’t been updated in a while because it didn’t work.
If said above is not clear, let me help you to clarify the basic enough answer you are looking for
add --pretty to your option you found but compressed all together
and write your output into a file, say caddyfile.json to /var/www by using >>
Tada, your new basic enough answer: caddy adapt --config /usr/local/www/Caddyfile --pretty >> /var/www/caddyfile.json
and if the space is too far apart in your json file , my method is open up the file in notepad , press Ctrl+H , replace ' ' ← (8 spaces) with ' ' <— (2 or more spaces)
That question is ambiguous though. There’s many different ways of running Caddy. You might run it as a systemd service, or in Docker, or manually via the command line, etc. Each of those have a different answer for how to make changes to how you run it.
Like I said, filling the help topic template is a rule here. If you don’t fill it out, it wastes both our time, because I don’t know the information I need to answer your questions accurately, so I have to repeat with additional questions, meaning we have more roundtrips.
volumes:
- ./temp/caddy-config.json:/etc/caddy/caddy-config.json
- ./certs/hx-dashboard.crt:/etc/caddy/hx-dashboard.crt
- ./certs/hx-dashboard.key:/etc/caddy/hx-dashboard.key
- hxd-dashboard-proxy:/data
command: ["caddy", "run", "--config", "/etc/caddy/caddy-config.json"]
https://caddy.community/t/cant-connect-to-database-behind-layer4-server/16168
I ended up using the clip found here to determine how to switch from using caddyfile in docker to json.