From 991de1fad3c12ba0b0a7a1ac402a616340b1b861 Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Thu, 17 Jun 2021 13:12:12 -0500 Subject: [PATCH] Document object parameters Signed-off-by: Carolyn Van Slyck --- docs/content/author-bundles.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/content/author-bundles.md b/docs/content/author-bundles.md index 7c7ffac8c..d28441658 100644 --- a/docs/content/author-bundles.md +++ b/docs/content/author-bundles.md @@ -131,7 +131,7 @@ parameters: ``` * `name`: The name of the parameter. -* `type`: The data type of the parameter: string, integer, number, boolean, or [file](#file-parameters). +* `type`: The data type of the parameter: string, integer, number, boolean, array, [object](#object-parameters), or [file](#file-parameters). * `default`: (Optional) The default value for the parameter, which will be used if not supplied elsewhere. * `env`: (Optional) The name for the destination environment variable in the bundle. Defaults to the name of the parameter in upper case, if path is not specified. * `path`: (Optional) The destination file path in the bundle. @@ -143,6 +143,30 @@ parameters: * `output`: An output name. The parameter's value is set to output's last value. If the output doesn't exist, then the parameter's default value is used when defined, otherwise the user is required to provide a value. +### Object Parameters + +Parameters can be JSON objects and validated using [JSON Schema](#parameter-and-output-schema) + +In the example below, the config parameter is defined as an object, with a default value. +At runtime, the value of the parameter is saved to a file located at /cnab/app/config.json. + +```yaml +parameters: + - name: config + type: object + path: /cnab/app/config.json + default: + logLevel: 11 + debug: true +``` + +A user can pass a different value to the bundle using the --param flag which accepts either a file path or a string value: + +``` +porter install --param '{"logLevel":2}' +porter install --param ./config.json +``` + ### File Parameters Porter supports passing a file as a parameter to a bundle.