3 ms·
Thanks for recommending it! I hear ya. The JSON config is definitely not trivial. I wrote our JSON docs and strove to made them easy to follow. You can travers
by mholt 5y ago
Thanks for recommending it!
I hear ya. The JSON config is definitely not trivial. I wrote our JSON docs and strove to made them easy to follow. You can traverse into the module structure piece-by-piece here: https://caddyserver.com/docs/json/ https://caddyserver.com/docs/json/
There is also a Caddy plugin by @abiosoft that can generate a JSON schema for your custom Caddy builds, which can then be used by IDEs to give you autocomplete and validation: https://github.com/abiosoft/caddy-json-schema https://github.com/abiosoft/caddy-json-schema
I also sometimes recommend writing your config by hand in the Caddyfile, then using `caddy adapt` to get the JSON equivalent. (It might not always be the prettiest JSON, since the adapter is only so smart.) But then you can fine-tune the JSON a little easier, possibly. Hope that helps!
- skrause 5y agoA few complete, fully working example JSON configuration files for common use cases would be really useful as well.
- mholt 5y agoAgreed. (Although, for now, you can run caddy adapt on your Caddyfile to get the JSON you're looking for.)
- evv 5y agoThanks! Somehow you knew that I was struggling with JSON config of a custom Caddy build (for the Cloudflare extension) caddy-json-schema looks great, I'll try this next time! not sure if I totally missed `caddy adapt` or if I had troubles with it.