@@ -71,6 +71,30 @@ configuration entry remains in the file for easy re-enabling.
7171with ``$ `` designate |TS | configuration variables and will be expanded
7272to their current value before the plugin is loaded.
7373
74+ ``config ``
75+ ----------
76+
77+ **Optional. ** Inline configuration content specified as a YAML scalar.
78+ The text is written to a temporary file at startup and the path is
79+ passed to the plugin as an argument, so existing plugins work without
80+ modification.
81+
82+ .. tip ::
83+
84+ Use a literal block scalar (``| ``) to preserve exact text including
85+ newlines and quoting -- this is important for plugins like
86+ ``txn_box.so `` that assign special meaning to YAML quoting.
87+
88+ .. note ::
89+
90+ Structured YAML (mappings or sequences) is rejected because
91+ re-serializing through a YAML emitter strips quoting semantics that
92+ some plugins depend on. For example, ``txn_box.so `` distinguishes
93+ ``"literal" `` (a quoted string) from ``extractor-name `` (an unquoted
94+ reference), and that distinction would be lost after a round-trip
95+ through ``YAML::Emitter ``. Supporting structured YAML may be
96+ revisited in the future.
97+
7498``load_order ``
7599--------------
76100
@@ -139,6 +163,8 @@ legacy :file:`plugin.config` format:
139163 plugin without removing or commenting out the line.
140164* **Explicit load ordering ** — use ``load_order `` to control loading
141165 priority independent of file position.
166+ * **Inline configuration ** — embed a plugin's config content directly
167+ via the ``config `` field instead of maintaining a separate file.
142168* **Variable expansion ** — ``$record `` references in ``params `` are
143169 expanded to their current value at load time (same as
144170 :file: `plugin.config `).
@@ -207,6 +233,70 @@ Despite the YAML sequence order, the actual load order is:
207233 Use gaps between ``load_order `` values (e.g. 100, 200, 300) so new
208234 plugins can be inserted later without renumbering.
209235
236+ Inline Configuration
237+ --------------------
238+
239+ The ``config `` field lets you embed a plugin's configuration directly in
240+ :file: `plugin.yaml ` instead of maintaining a separate file. At startup, |TS |
241+ writes the content to a temporary file in the configuration directory and passes
242+ the path of that file to the plugin as an argument — exactly the same way a
243+ ``params `` entry pointing to an external file would work. The plugin reads the
244+ file as usual; it has no knowledge the content was inlined.
245+
246+ Use the YAML literal block scalar (``| ``) to provide the content:
247+
248+ .. code-block :: yaml
249+
250+ plugins :
251+ - path : header_rewrite.so
252+ config : |
253+ cond %{SEND_RESPONSE_HDR_HOOK}
254+ set-header X-Debug "true"
255+
256+ The text after ``| `` is preserved exactly (including newlines and
257+ indentation). It is written to a temporary file named after the plugin
258+ (e.g. ``<config_dir>/.header_rewrite_inline_1.conf ``). Temporary files
259+ from a previous run are removed automatically at startup.
260+
261+ This works equally well for plugins that read YAML configuration files.
262+ The block scalar preserves quoting and formatting that some YAML-consuming
263+ plugins rely on:
264+
265+ .. code-block :: yaml
266+
267+ plugins :
268+ - path : txn_box.so
269+ config : |
270+ txn_box:
271+ when: proxy-rsp
272+ do:
273+ - proxy-rsp-field<X-TxnBox>: "inline-config-active"
274+
275+ .. note ::
276+
277+ The ``config `` field and ``params `` can be used together. When both are
278+ present, the temporary file path is inserted before the ``params `` entries
279+ in the argument vector:
280+
281+ .. code-block :: yaml
282+
283+ plugins :
284+ - path : header_rewrite.so
285+ config : |
286+ cond %{SEND_RESPONSE_HDR_HOOK}
287+ set-header X-Source "inline"
288+ params :
289+ - --verbose
290+
291+ The plugin receives ``argv = ["header_rewrite.so",
292+ "<config_dir>/.header_rewrite_inline_1.conf", "--verbose"] ``.
293+
294+ The inline file path is always a bare positional argument at ``argv[1] ``.
295+ This works for plugins that take a config file as their first argument
296+ (e.g., ``header_rewrite.so ``, ``txn_box.so ``). Plugins that require a
297+ flag before the filename (e.g., ``--config <file> ``) should use ``params ``
298+ pointing to a separate file instead of ``config ``.
299+
210300Configuration Variable Expansion
211301---------------------------------
212302
0 commit comments