Writing Config Adapters

    If one does not already exist for the language/syntax/format you prefer, you can write one!

    The returned JSON should not be indented; it should always be compact. The caller can always prettify it if they want to.

    When populating fields of the config that are json.RawMessage types (i.e. module fields), use the JSON() and JSONModuleObject() functions:

    • is for marshaling module values without the module name embedded. (Often used for ModuleMap fields where the module name is the map key.)

    Caddyfile Server Types

    1. func init() {
    2. caddyconfig.RegisterAdapter("caddyfile", caddyfile.Adapter{ServerType: ServerType{}})

    You would implement the and register your own adapter accordingly.