@marcel91200 / caddy Mirror · read-only / commits / 5ded5804
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 13, 05:30 UTC

cmd: Adjust documentation for commands (#5377)

Francis Lavoie committed Feb 16, 2023 at 11:14 UTC 5ded580444e9258cb35a9c94192d3c1d63e7b74f
2 files changed +31 -16
cmd/commands.go
+19 -11
@@ -91,14 +91,15 @@ the KEY=VALUE format will be loaded into the Caddy process.
91
92 On Windows, the spawned child process will remain attached to the terminal, so
93 closing the window will forcefully stop Caddy; to avoid forgetting this, try
94 -using 'caddy run' instead to keep it in the foreground.`,
94 +using 'caddy run' instead to keep it in the foreground.
95 +`,
96 Flags: func() *flag.FlagSet {
97 fs := flag.NewFlagSet("start", flag.ExitOnError)
98 fs.String("config", "", "Configuration file")
98 - fs.String("envfile", "", "Environment file to load")
99 fs.String("adapter", "", "Name of config adapter to apply")
100 - fs.String("pidfile", "", "Path of file to which to write process ID")
100 + fs.String("envfile", "", "Environment file to load")
101 fs.Bool("watch", false, "Reload changed config file automatically")
102 + fs.String("pidfile", "", "Path of file to which to write process ID")
103 return fs
104 }(),
105 })
@@ -138,7 +139,8 @@ save file. It is not an error if --resume is used and no autosave file exists.
139
140 If --watch is specified, the config file will be loaded automatically after
141 changes. ⚠️ This can make unintentional config changes easier; only use this
141 -option in a local development environment.`,
142 +option in a local development environment.
143 +`,
144 Flags: func() *flag.FlagSet {
145 fs := flag.NewFlagSet("run", flag.ExitOnError)
146 fs.String("config", "", "Configuration file")
@@ -163,7 +165,8 @@ Stops the background Caddy process as gracefully as possible.
165
166 It requires that the admin API is enabled and accessible, since it will
167 use the API's /stop endpoint. The address of this request can be customized
166 -using the --address flag, or from the given --config, if not the default.`,
168 +using the --address flag, or from the given --config, if not the default.
169 +`,
170 Flags: func() *flag.FlagSet {
171 fs := flag.NewFlagSet("stop", flag.ExitOnError)
172 fs.String("address", "", "The address to use to reach the admin API endpoint, if not the default")
@@ -185,7 +188,8 @@ workflows revolving around config files.
188
189 Since the admin endpoint is configurable, the endpoint configuration is loaded
190 from the --address flag if specified; otherwise it is loaded from the given
188 -config file; otherwise the default is assumed.`,
191 +config file; otherwise the default is assumed.
192 +`,
193 Flags: func() *flag.FlagSet {
194 fs := flag.NewFlagSet("reload", flag.ExitOnError)
195 fs.String("config", "", "Configuration file (required)")
@@ -273,7 +277,8 @@ for human readability.
277
278 If --validate is used, the adapted config will be checked for validity.
279 If the config is invalid, an error will be printed to stderr and a non-
276 -zero exit status will be returned.`,
280 +zero exit status will be returned.
281 +`,
282 Flags: func() *flag.FlagSet {
283 fs := flag.NewFlagSet("adapt", flag.ExitOnError)
284 fs.String("config", "", "Configuration file to adapt (required)")
@@ -295,7 +300,8 @@ This reveals any errors with the configuration through the loading and
300 provisioning stages.
301
302 If --envfile is specified, an environment file with environment variables in
298 -the KEY=VALUE format will be loaded into the Caddy process.`,
303 +the KEY=VALUE format will be loaded into the Caddy process.
304 +`,
305 Flags: func() *flag.FlagSet {
306 fs := flag.NewFlagSet("validate", flag.ExitOnError)
307 fs.String("config", "", "Input configuration file")
@@ -308,7 +314,7 @@ the KEY=VALUE format will be loaded into the Caddy process.`,
314 RegisterCommand(Command{
315 Name: "fmt",
316 Func: cmdFmt,
311 - Usage: "[--overwrite] [<path>]",
317 + Usage: "[--overwrite] [--diff] [<path>]",
318 Short: "Formats a Caddyfile",
319 Long: `
320 Formats the Caddyfile by adding proper indentation and spaces to improve
@@ -324,7 +330,8 @@ is not a valid patch format.
330
331 If you wish you use stdin instead of a regular file, use - as the path.
332 When reading from stdin, the --overwrite flag has no effect: the result
327 -is always printed to stdout.`,
333 +is always printed to stdout.
334 +`,
335 Flags: func() *flag.FlagSet {
336 fs := flag.NewFlagSet("fmt", flag.ExitOnError)
337 fs.Bool("overwrite", false, "Overwrite the input file with the results")
@@ -339,7 +346,8 @@ is always printed to stdout.`,
346 Short: "Upgrade Caddy (EXPERIMENTAL)",
347 Long: `
348 Downloads an updated Caddy binary with the same modules/plugins at the
342 -latest versions. EXPERIMENTAL: May be changed or removed.`,
349 +latest versions. EXPERIMENTAL: May be changed or removed.
350 +`,
351 Flags: func() *flag.FlagSet {
352 fs := flag.NewFlagSet("upgrade", flag.ExitOnError)
353 fs.Bool("keep-backup", false, "Keep the backed up binary, instead of deleting it")
modules/caddyhttp/reverseproxy/command.go
+12 -5
@@ -35,7 +35,7 @@ func init() {
35 caddycmd.RegisterCommand(caddycmd.Command{
36 Name: "reverse-proxy",
37 Func: cmdReverseProxy,
38 - Usage: "[--from <addr>] [--to <addr>] [--change-host-header]",
38 + Usage: "[--from <addr>] [--to <addr>] [--change-host-header] [--insecure] [--internal-certs] [--disable-redirects]",
39 Short: "A quick and production-ready reverse proxy",
40 Long: `
41 A simple but production-ready reverse proxy. Useful for quick deployments,
@@ -52,16 +52,23 @@ If the --from address has a host or IP, Caddy will attempt to serve the
52 proxy over HTTPS with a certificate (unless overridden by the HTTP scheme
53 or port).
54
55 -If --change-host-header is set, the Host header on the request will be modified
56 -from its original incoming value to the address of the upstream. (Otherwise, by
57 -default, all incoming headers are passed through unmodified.)
55 +If serving HTTPS:
56 + --disable-redirects can be used to avoid binding to the HTTP port.
57 + --internal-certs can be used to force issuance certs using the internal
58 + CA instead of attempting to issue a public certificate.
59 +
60 +For proxying:
61 + --change-host-header sets the Host header on the request to the address
62 + of the upstream, instead of defaulting to the incoming Host header.
63 + --insecure disables TLS verification with the upstream. WARNING: THIS
64 + DISABLES SECURITY BY NOT VERIFYING THE UPSTREAM'S CERTIFICATE.
65 `,
66 Flags: func() *flag.FlagSet {
67 fs := flag.NewFlagSet("reverse-proxy", flag.ExitOnError)
68 fs.String("from", "localhost", "Address on which to receive traffic")
69 fs.Var(&reverseProxyCmdTo, "to", "Upstream address(es) to which traffic should be sent")
70 fs.Bool("change-host-header", false, "Set upstream Host header to address of upstream")
64 - fs.Bool("insecure", false, "Disable TLS verification (WARNING: DISABLES SECURITY BY NOT VERIFYING SSL CERTIFICATES!)")
71 + fs.Bool("insecure", false, "Disable TLS verification (WARNING: DISABLES SECURITY BY NOT VERIFYING TLS CERTIFICATES!)")
72 fs.Bool("internal-certs", false, "Use internal CA for issuing certs")
73 fs.Bool("debug", false, "Enable verbose debug logs")
74 fs.Bool("disable-redirects", false, "Disable HTTP->HTTPS redirects")