Package to write Caddyfile

Hello!

Anybody know of a package/library which will write Caddyfiles. Ideally written in Golang. I foresee it marshaling struct data into a single caddyfile. The reverse of what Caddy does?

Possibly someone has already done this?

The Caddyfile is loosely structured, and it’s mostly just space-separated string concatenation. You could try the ToJSON and FromJSON functions in the caddyfile package: caddyfile package - github.com/mholt/caddy/caddyfile - pkg.go.dev - otherwise I’d recommend just doing string concatenation.

1 Like

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