MCPcopy
hub / github.com/caddyserver/caddy / App

Struct App

modules/caddyhttp/app.go:115–167  ·  view source on GitHub ↗

App is a robust, production-ready HTTP server. HTTPS is enabled by default if host matchers with qualifying names are used in any of routes; certificates are automatically provisioned and renewed. Additionally, automatic HTTPS will also enable HTTPS for servers that listen only on the HTTPS port bu

Source from the content-addressed store, hash-verified

113// `{http.shutting_down}` | True if the HTTP app is shutting down
114// `{http.time_until_shutdown}` | Time until HTTP server shutdown, if scheduled
115type App struct {
116 // HTTPPort specifies the port to use for HTTP (as opposed to HTTPS),
117 // which is used when setting up HTTP->HTTPS redirects or ACME HTTP
118 // challenge solvers. Default: 80.
119 HTTPPort int `json:"http_port,omitempty"`
120
121 // HTTPSPort specifies the port to use for HTTPS, which is used when
122 // solving the ACME TLS-ALPN challenges, or whenever HTTPS is needed
123 // but no specific port number is given. Default: 443.
124 HTTPSPort int `json:"https_port,omitempty"`
125
126 // GracePeriod is how long to wait for active connections when shutting
127 // down the servers. During the grace period, no new connections are
128 // accepted, idle connections are closed, and active connections will
129 // be given the full length of time to become idle and close.
130 // Once the grace period is over, connections will be forcefully closed.
131 // If zero, the grace period is eternal. Default: 0.
132 GracePeriod caddy.Duration `json:"grace_period,omitempty"`
133
134 // ShutdownDelay is how long to wait before initiating the grace
135 // period. When this app is stopping (e.g. during a config reload or
136 // process exit), all servers will be shut down. Normally this immediately
137 // initiates the grace period. However, if this delay is configured, servers
138 // will not be shut down until the delay is over. During this time, servers
139 // continue to function normally and allow new connections. At the end, the
140 // grace period will begin. This can be useful to allow downstream load
141 // balancers time to move this instance out of the rotation without hiccups.
142 //
143 // When shutdown has been scheduled, placeholders {http.shutting_down} (bool)
144 // and {http.time_until_shutdown} (duration) may be useful for health checks.
145 ShutdownDelay caddy.Duration `json:"shutdown_delay,omitempty"`
146
147 // Servers is the list of servers, keyed by arbitrary names chosen
148 // at your discretion for your own convenience; the keys do not
149 // affect functionality.
150 Servers map[string]*Server `json:"servers,omitempty"`
151
152 // If set, metrics observations will be enabled.
153 // This setting is EXPERIMENTAL and subject to change.
154 Metrics *Metrics `json:"metrics,omitempty"`
155
156 ctx caddy.Context
157 logger *zap.Logger
158 tlsApp *caddytls.TLS
159
160 // stopped indicates whether the app has stopped
161 // It can only happen if it has started successfully in the first place.
162 // Otherwise, Cleanup will call Stop to clean up resources.
163 stopped bool
164
165 // used temporarily between phases 1 and 2 of auto HTTPS
166 allCertDomains map[string]struct{}
167}
168
169// CaddyModule returns the Caddy module information.
170func (App) CaddyModule() caddy.ModuleInfo {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected