General minor improvements to docs

This commit is contained in:
Matthew Holt 2021-09-24 18:31:01 -06:00
parent 3336faf254
commit 501da21f20
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
9 changed files with 46 additions and 35 deletions

View File

@ -176,6 +176,8 @@ Please use our [issue tracker](https://github.com/caddyserver/caddy/issues) only
## About ## About
Matthew Holt began developing Caddy in 2014 while studying computer science at Brigham Young University. It soon became the first web server to use HTTPS automatically and by default, and now has hundreds of contributors and has served trillions of HTTPS requests.
**The name "Caddy" is trademarked.** The name of the software is "Caddy", not "Caddy Server" or "CaddyServer". Please call it "Caddy" or, if you wish to clarify, "the Caddy web server". Caddy is a registered trademark of Stack Holdings GmbH. **The name "Caddy" is trademarked.** The name of the software is "Caddy", not "Caddy Server" or "CaddyServer". Please call it "Caddy" or, if you wish to clarify, "the Caddy web server". Caddy is a registered trademark of Stack Holdings GmbH.
- _Project on Twitter: [@caddyserver](https://twitter.com/caddyserver)_ - _Project on Twitter: [@caddyserver](https://twitter.com/caddyserver)_

View File

@ -97,7 +97,8 @@ type (
// ``` // ```
MatchQuery url.Values MatchQuery url.Values
// MatchHeader matches requests by header fields. It performs fast, // MatchHeader matches requests by header fields. The key is the field
// name and the array is the list of field values. It performs fast,
// exact string comparisons of the field values. Fast prefix, suffix, // exact string comparisons of the field values. Fast prefix, suffix,
// and substring matches can also be done by suffixing, prefixing, or // and substring matches can also be done by suffixing, prefixing, or
// surrounding the value with the wildcard `*` character, respectively. // surrounding the value with the wildcard `*` character, respectively.
@ -114,7 +115,8 @@ type (
// (potentially leading to collisions). // (potentially leading to collisions).
MatchHeaderRE map[string]*MatchRegexp MatchHeaderRE map[string]*MatchRegexp
// MatchProtocol matches requests by protocol. // MatchProtocol matches requests by protocol. Recognized values are
// "http", "https", and "grpc".
MatchProtocol string MatchProtocol string
// MatchRemoteIP matches requests by client IP (or CIDR range). // MatchRemoteIP matches requests by client IP (or CIDR range).
@ -139,9 +141,9 @@ type (
// matchers within a set work the same (i.e. different matchers in // matchers within a set work the same (i.e. different matchers in
// the same set are AND'ed). // the same set are AND'ed).
// //
// Note that the generated docs which describe the structure of // NOTE: The generated docs which describe the structure of this
// this module are wrong because of how this type unmarshals JSON // module are wrong because of how this type unmarshals JSON in a
// in a custom way. The correct structure is: // custom way. The correct structure is:
// //
// ```json // ```json
// [ // [

View File

@ -32,7 +32,7 @@ type ResponseMatcher struct {
// If set, each header specified must be one of the // If set, each header specified must be one of the
// specified values, with the same logic used by the // specified values, with the same logic used by the
// request header matcher. // [request header matcher](/docs/json/apps/http/servers/routes/match/header/).
Headers http.Header `json:"headers,omitempty"` Headers http.Header `json:"headers,omitempty"`
} }

View File

@ -237,7 +237,8 @@ type Templates struct {
// Default is text/plain, text/markdown, and text/html. // Default is text/plain, text/markdown, and text/html.
MIMETypes []string `json:"mime_types,omitempty"` MIMETypes []string `json:"mime_types,omitempty"`
// The template action delimiters. // The template action delimiters. If set, must be precisely two elements:
// the opening and closing delimiters. Default: `["{{", "}}"]`
Delimiters []string `json:"delimiters,omitempty"` Delimiters []string `json:"delimiters,omitempty"`
} }

View File

@ -29,9 +29,14 @@ func init() {
caddy.RegisterModule(MatchVarsRE{}) caddy.RegisterModule(MatchVarsRE{})
} }
// VarsMiddleware is an HTTP middleware which sets variables // VarsMiddleware is an HTTP middleware which sets variables to
// in the context, mainly for use by placeholders. The // have values that can be used in the HTTP request handler
// placeholders have the form: `{http.vars.variable_name}` // chain. The primary way to access variables is with placeholders,
// which have the form: `{http.vars.variable_name}`, or with
// the `vars` and `vars_regexp` request matchers.
//
// The key is the variable name, and the value is the value of the
// variable. Both the name and value may use or contain placeholders.
type VarsMiddleware map[string]string type VarsMiddleware map[string]string
// CaddyModule returns the Caddy module information. // CaddyModule returns the Caddy module information.

View File

@ -26,10 +26,15 @@ func init() {
} }
// PKI provides Public Key Infrastructure facilities for Caddy. // PKI provides Public Key Infrastructure facilities for Caddy.
//
// This app can define certificate authorities (CAs) which are capable
// of signing certificates. Other modules can be configured to use
// the CAs defined by this app for issuing certificates or getting
// key information needed for establishing trust.
type PKI struct { type PKI struct {
// The CAs to manage. Each CA is keyed by an ID that is used // The certificate authorities to manage. Each CA is keyed by an
// to uniquely identify it from other CAs. The default CA ID // ID that is used to uniquely identify it from other CAs.
// is "local". // The default CA ID is "local".
CAs map[string]*CA `json:"certificate_authorities,omitempty"` CAs map[string]*CA `json:"certificate_authorities,omitempty"`
ctx caddy.Context ctx caddy.Context

View File

@ -36,20 +36,16 @@ func init() {
caddy.RegisterModule(ACMEIssuer{}) caddy.RegisterModule(ACMEIssuer{})
} }
// ACMEIssuer makes an ACME manager // ACMEIssuer manages certificates using the ACME protocol (RFC 8555).
// for managing certificates using ACME.
//
// TODO: support multiple ACME endpoints (probably
// requires an array of these structs) - caddy would
// also have to load certs from the backup CAs if the
// first one is expired...
type ACMEIssuer struct { type ACMEIssuer struct {
// The URL to the CA's ACME directory endpoint. // The URL to the CA's ACME directory endpoint. Default:
// https://acme-v02.api.letsencrypt.org/directory
CA string `json:"ca,omitempty"` CA string `json:"ca,omitempty"`
// The URL to the test CA's ACME directory endpoint. // The URL to the test CA's ACME directory endpoint.
// This endpoint is only used during retries if there // This endpoint is only used during retries if there
// is a failure using the primary CA. // is a failure using the primary CA. Default:
// https://acme-staging-v02.api.letsencrypt.org/directory
TestCA string `json:"test_ca,omitempty"` TestCA string `json:"test_ca,omitempty"`
// Your email address, so the CA can contact you if necessary. // Your email address, so the CA can contact you if necessary.
@ -71,6 +67,7 @@ type ACMEIssuer struct {
ExternalAccount *acme.EAB `json:"external_account,omitempty"` ExternalAccount *acme.EAB `json:"external_account,omitempty"`
// Time to wait before timing out an ACME operation. // Time to wait before timing out an ACME operation.
// Default: 0 (no timeout)
ACMETimeout caddy.Duration `json:"acme_timeout,omitempty"` ACMETimeout caddy.Duration `json:"acme_timeout,omitempty"`
// Configures the various ACME challenge types. // Configures the various ACME challenge types.

View File

@ -27,8 +27,8 @@ import (
// AutomationConfig governs the automated management of TLS certificates. // AutomationConfig governs the automated management of TLS certificates.
type AutomationConfig struct { type AutomationConfig struct {
// The list of automation policies. The first matching // The list of automation policies. The first policy matching
// policy will be applied for a given certificate/name. // a certificate or subject name will be applied.
Policies []*AutomationPolicy `json:"policies,omitempty"` Policies []*AutomationPolicy `json:"policies,omitempty"`
// On-Demand TLS defers certificate operations to the // On-Demand TLS defers certificate operations to the
@ -39,7 +39,7 @@ type AutomationConfig struct {
// In 2015, Caddy became the first web server to // In 2015, Caddy became the first web server to
// implement this experimental technology. // implement this experimental technology.
// //
// Note that this field does not enable on-demand TLS, // Note that this field does not enable on-demand TLS;
// it only configures it for when it is used. To enable // it only configures it for when it is used. To enable
// it, create an automation policy with `on_demand`. // it, create an automation policy with `on_demand`.
OnDemand *OnDemandConfig `json:"on_demand,omitempty"` OnDemand *OnDemandConfig `json:"on_demand,omitempty"`

View File

@ -47,7 +47,7 @@ type TLS struct {
// have to be refreshed manually before they expire. // have to be refreshed manually before they expire.
CertificatesRaw caddy.ModuleMap `json:"certificates,omitempty" caddy:"namespace=tls.certificates"` CertificatesRaw caddy.ModuleMap `json:"certificates,omitempty" caddy:"namespace=tls.certificates"`
// Configures the automation of certificate management. // Configures certificate automation.
Automation *AutomationConfig `json:"automation,omitempty"` Automation *AutomationConfig `json:"automation,omitempty"`
// Configures session ticket ephemeral keys (STEKs). // Configures session ticket ephemeral keys (STEKs).
@ -527,14 +527,14 @@ type Certificate struct {
Tags []string Tags []string
} }
// AutomateLoader will automatically manage certificates for the names // AutomateLoader will automatically manage certificates for the names in the
// in the list, including obtaining and renewing certificates. Automated // list, including obtaining and renewing certificates. Automated certificates
// certificates are managed according to their matching automation policy, // are managed according to their matching automation policy, configured
// configured elsewhere in this app. // elsewhere in this app.
// //
// This is a no-op certificate loader module that is treated as a special // Technically, this is a no-op certificate loader module that is treated as
// case: it uses this app's automation features to load certificates for the // a special case: it uses this app's automation features to load certificates
// list of hostnames, rather than loading certificates manually. // for the list of hostnames, rather than loading certificates manually.
type AutomateLoader []string type AutomateLoader []string
// CaddyModule returns the Caddy module information. // CaddyModule returns the Caddy module information.
@ -549,8 +549,7 @@ func (AutomateLoader) CaddyModule() caddy.ModuleInfo {
type CertCacheOptions struct { type CertCacheOptions struct {
// Maximum number of certificates to allow in the // Maximum number of certificates to allow in the
// cache. If reached, certificates will be randomly // cache. If reached, certificates will be randomly
// evicted to make room for new ones. Default: 0 // evicted to make room for new ones. Default: 10,000
// (no limit).
Capacity int `json:"capacity,omitempty"` Capacity int `json:"capacity,omitempty"`
} }