@@ -436,19 +436,36 @@ functionality is especially useful for reading SSL certificates and keys.
436436
437437## Variable Expansion
438438
439- It's possible to refer to other earlier settings as ` $SET:name ` .
439+ It's possible to refer to other settings as ` $SET:name ` .
440+
441+ [[ changed,settings_delayed_expansion_changed]] Generally, the setting values
442+ are expanded at the end of the configuration parsing. Also the expansion takes
443+ into account what filters are active, as well as chaining of settings.
440444
441445Example:
442446
443447```
444- key = value1
445- key2 = $SET:key value2
446- # Equivalent to key2 = value1 value2
448+ service imap {
449+ # expands to "_dovecot"
450+ service_user = $SET:default_internal_user
451+ unix_listener imap {
452+ # expands to the parent filter's service_user, which expands to "_dovecot"
453+ user = $SET:service_user
454+ }
455+ }
456+ # This can be set after the $SET:default_internal_user usage above
457+ default_internal_user = _dovecot
447458```
448459
449- However, you must be careful with the ordering of these in the configuration
450- file, because the ` $SET:variables ` are expanded immediately while parsing the
451- config file and they're not updated later.
460+ One exception is that if the setting refers to itself, the whole value is
461+ expanded immediately with the current settings' values. For example:
462+
463+ ```
464+ login_log_format_elements = user=<%{user}>
465+ login_log_format_elements = $SET:login_log_format_elements method=%{mechanism}
466+ login_log_format_elements = $SET:login_log_format_elements session=<%{session}>
467+ # Expands to: user=<%{user}> method=%{mechanism} session=<%{session}>
468+ ```
452469
453470See also [[ link,settings_variables]] .
454471
0 commit comments