Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document object parameters #1645

Merged
merged 1 commit into from
Jun 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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