HTTPLoader can load Caddy configs over HTTP(S). If the response is not a JSON config, a config adapter must be specified either in the loader config (`adapter`), or in the Content-Type HTTP header returned in the HTTP response from the server. The Content-Type header is read just like the admin API
| 39 | // over the HTTP server (but can still trust its response), you can override |
| 40 | // the Content-Type header by setting the `adapter` property in this config. |
| 41 | type HTTPLoader struct { |
| 42 | // The method for the request. Default: GET |
| 43 | Method string `json:"method,omitempty"` |
| 44 | |
| 45 | // The URL of the request. |
| 46 | URL string `json:"url,omitempty"` |
| 47 | |
| 48 | // HTTP headers to add to the request. |
| 49 | Headers http.Header `json:"header,omitempty"` |
| 50 | |
| 51 | // Maximum time allowed for a complete connection and request. |
| 52 | Timeout caddy.Duration `json:"timeout,omitempty"` |
| 53 | |
| 54 | // The name of the config adapter to use, if any. Only needed |
| 55 | // if the HTTP response is not a JSON config and if the server's |
| 56 | // Content-Type header is missing or incorrect. |
| 57 | Adapter string `json:"adapter,omitempty"` |
| 58 | |
| 59 | TLS *struct { |
| 60 | // Present this instance's managed remote identity credentials to the server. |
| 61 | UseServerIdentity bool `json:"use_server_identity,omitempty"` |
| 62 | |
| 63 | // PEM-encoded client certificate filename to present to the server. |
| 64 | ClientCertificateFile string `json:"client_certificate_file,omitempty"` |
| 65 | |
| 66 | // PEM-encoded key to use with the client certificate. |
| 67 | ClientCertificateKeyFile string `json:"client_certificate_key_file,omitempty"` |
| 68 | |
| 69 | // List of PEM-encoded CA certificate files to add to the same trust |
| 70 | // store as RootCAPool (or root_ca_pool in the JSON). |
| 71 | RootCAPEMFiles []string `json:"root_ca_pem_files,omitempty"` |
| 72 | } `json:"tls,omitempty"` |
| 73 | } |
| 74 | |
| 75 | // CaddyModule returns the Caddy module information. |
| 76 | func (HTTPLoader) CaddyModule() caddy.ModuleInfo { |
nothing calls this directly
no outgoing calls
no test coverage detected