Skip to content

Commit f6a6538

Browse files
committed
settings: Document <<MARKER heredoc syntax for multi-line values
Added in 2.4.5. Covers the new syntax.md section, updates the File type description to prefer heredoc over inline: for config-file use, and registers the settings_syntax_heredoc_added tag.
1 parent 1f87c24 commit f6a6538

3 files changed

Lines changed: 47 additions & 4 deletions

File tree

‎data/updates.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export const updates = {
172172
settings_passdb_mechanisms_filter_added: '2.4.0',
173173
settings_passdb_static_password_added: '2.4.0',
174174
settings_service_reuse_port_added: '2.4.4',
175+
settings_syntax_heredoc_added: '2.4.5',
175176
settings_ssl_client_ca_added: '2.4.0',
176177
settings_ssl_imapc_removed: '2.4.0',
177178
settings_ssl_request_client_cert_changed: '2.4.0',

‎docs/core/settings/syntax.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,39 @@ read immediately whenever parsing the configuration file, so if it changes
449449
afterwards it requires a configuration reload to see the changes. This
450450
functionality is especially useful for reading SSL certificates and keys.
451451

452+
## Inline Multi-line Values (Heredoc)
453+
454+
[[added,settings_syntax_heredoc_added]]
455+
456+
It's possible to set multi-line values directly in the configuration file
457+
using the heredoc syntax `<<MARKER`:
458+
459+
```doveconf[dovecot.conf]
460+
key = <<END
461+
line one
462+
line two
463+
END
464+
```
465+
466+
The marker (`END` above) can be any string that does not appear as a line on
467+
its own within the value. The terminating marker line must match exactly —
468+
any extra whitespace after the marker will prevent it from being recognized.
469+
Each content line is included in the value as-is, including a trailing newline.
470+
471+
This is especially useful for [[link,settings_types_file,file settings]] such
472+
as SSL certificates and keys, where the content spans multiple lines:
473+
474+
```doveconf[dovecot.conf]
475+
ssl_server_ca_file = <<END
476+
-----BEGIN CERTIFICATE-----
477+
...
478+
-----END CERTIFICATE-----
479+
END
480+
```
481+
482+
`doveconf` output preserves the original marker, so `<<FOO` in `dovecot.conf`
483+
is reproduced as `<<FOO` in `doveconf` output.
484+
452485
## Variable Expansion
453486

454487
It's possible to refer to other settings as `$SET:name`.

‎docs/core/settings/types.md‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,19 @@ is delayed until the process accessing the setting expands it. The process
184184
is usually not running as root at this point, so you may need to adjust file
185185
permissions.
186186

187-
It's possible to give inline values (instead of a path to a file) for the
188-
setting by using `inline:` prefix in the value. For example userdb could be
189-
returning `crypt_global_public_key_file=inline:<public key content>` without
190-
having to use files.
187+
It's possible to give inline values (instead of a path to a file) using the
188+
[[link,settings_syntax,heredoc syntax]] (`<<MARKER`). For example:
189+
190+
```doveconf[dovecot.conf]
191+
ssl_server_ca_file = <<END
192+
-----BEGIN CERTIFICATE-----
193+
...
194+
-----END CERTIFICATE-----
195+
END
196+
```
197+
198+
When returning file settings from userdb (where heredoc isn't available), use
199+
the `inline:` prefix: `crypt_global_public_key_file=inline:<public key content>`.
191200

192201
## Named Filter
193202

0 commit comments

Comments
 (0)