Skip to content

Commit

Permalink
Document object parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Carolyn Van Slyck <[email protected]>
  • Loading branch information
carolynvs committed Jun 17, 2021
1 parent 9016226 commit 991de1f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion docs/content/author-bundles.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 991de1f

Please sign in to comment.