mirror of
https://github.com/caddyserver/website.git
synced 2025-04-23 05:26:16 -04:00
docs: More changes for upcoming v2.5.0 release (#226)
This commit is contained in:
parent
35a02d78d7
commit
eaf0aae816
6 changed files with 73 additions and 8 deletions
|
@ -29,6 +29,8 @@ map [<matcher>] <source> <destinations...> {
|
|||
|
||||
As a special case, the Caddyfile parser treats outputs that are a literal hyphen (`-`) as null/nil values. This is useful if you want to fall back to a default value for that particular output in the case of the given input, but want to use non-default values for other outputs.
|
||||
|
||||
The outputs will be type converted if possible; `true` and `false` will be converted to boolean types, and numeric values will be converted to integer or float accordingly. To avoid this conversion, you may wrap the output with [quotes](/docs/caddyfile/concepts#tokens-and-quotes) and they will stay strings.
|
||||
|
||||
The number of outputs for each mapping must not exceed the number of destinations; however, for convenience, there may be fewer outputs than destinations, and any missing outputs will be filled in implicitly.
|
||||
|
||||
If a regular expression was used as the input, then the capture groups can be referenced with `${group}` where `group` is either the name or number of the capture group in the expression. Capture group `0` is the full regexp match, `1` is the first capture group, `2` is the second capture group, and so on.
|
||||
|
|
|
@ -130,6 +130,7 @@ Obtains certificates using the ACME protocol.
|
|||
trusted_roots <pem_files...>
|
||||
dns <provider_name> [<options>]
|
||||
propagation_timeout <duration>
|
||||
propagation_delay <duration>
|
||||
resolvers <dns_servers...>
|
||||
preferred_chains [smallest] {
|
||||
root_common_name <common_names...>
|
||||
|
@ -149,7 +150,8 @@ Obtains certificates using the ACME protocol.
|
|||
- **eab** <span id="eab"/> specifies an External Account Binding which may be required with some ACME CAs.
|
||||
- **trusted_roots** <span id="trusted_roots"/> is one or more root certificates (as PEM filenames) to trust when connecting to the ACME CA server.
|
||||
- **dns** <span id="dns"/> configures the DNS challenge.
|
||||
- **propagation_timeout** <span id="propagation_timeout"/> is a [duration value](/docs/conventions#durations) that sets how long to wait for DNS TXT records to propagate when using the DNS challenge. Default 2 minutes.
|
||||
- **propagation_timeout** <span id="propagation_timeout"/> is a [duration value](/docs/conventions#durations) that sets the maximum time to wait for the DNS TXT records to appear when using the DNS challenge. Set to `-1` to disable propagation checks. Default 2 minutes.
|
||||
- **propagation_delay** <span id="propagation_delay"/> is a [duration value](/docs/conventions#durations) that sets how long to wait before starting DNS TXT records propagation checks when using the DNS challenge. Default 0 (no wait).
|
||||
- **resolvers** <span id="resolvers"/> customizes the DNS resolvers used when performing the DNS challenge; these take precedence over system resolvers or any default ones.
|
||||
- **preferred_chains** <span id="preferred_chains"/> specifies which certificate chains Caddy should prefer; useful if your CA provides multiple chains. Use one of the following options:
|
||||
- **smallest** <span id="smallest"/> will tell Caddy to prefer chains with the fewest amount of bytes.
|
||||
|
|
53
src/docs/markdown/caddyfile/directives/vars.md
Normal file
53
src/docs/markdown/caddyfile/directives/vars.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
title: vars (Caddyfile directive)
|
||||
---
|
||||
|
||||
# vars
|
||||
|
||||
Sets one or more variables to a particular value, to be used later in the request handling chain.
|
||||
|
||||
The primary way to access variables is with placeholders, which have the form `{vars.variable_name}`, or with the [`vars`](/docs/caddyfile/matchers#vars) and [`vars_regexp`](/docs/caddyfile/matchers#vars_regexp) request matchers.
|
||||
|
||||
## Syntax
|
||||
|
||||
```caddy-d
|
||||
vars [<matcher>] [<name> <value>] {
|
||||
<name> <value>
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
- **<name>** is the variable name to set.
|
||||
|
||||
- **<value>** is the value of the variable.
|
||||
|
||||
The value will be type converted if possible; `true` and `false` will be converted to boolean types, and numeric values will be converted to integer or float accordingly. To avoid this conversion, you may wrap the output with [quotes](/docs/caddyfile/concepts#tokens-and-quotes) and they will stay strings.
|
||||
|
||||
## Examples
|
||||
|
||||
To set a single variable, the value being conditional based on the request path, then responding with the value:
|
||||
|
||||
```caddy-d
|
||||
vars /foo* isFoo "yep"
|
||||
vars isFoo "nope"
|
||||
|
||||
respond {vars.isFoo}
|
||||
```
|
||||
|
||||
To set multiple variables, each converted to the appropriate scalar type:
|
||||
|
||||
```caddy-d
|
||||
vars {
|
||||
# boolean
|
||||
abc true
|
||||
|
||||
# integer
|
||||
def 1
|
||||
|
||||
# float
|
||||
ghi 2.3
|
||||
|
||||
# string
|
||||
jkl "example"
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue