2.9.0-beta.1 • Published 11 months ago

@app-config/exec v2.9.0-beta.1

Weekly downloads
127
License
MPL-2.0
Repository
github
Last release
11 months ago

App Config Exec Plugin

Run arbitrary programs or shell commands to generate config.

$exec: echo Hello World!

Usage

Basic:

$exec: echo Hello World!

Auto-parse output as YAML/TOML/JSON/JSON5:

$exec:
  command: curl https://my-api.example.com
  parseOutput: true

Build a custom script to generate config:

$exec: node ./my-custom-config-generator.js

Retrieve arbitrary information:

Node v8 version:

$exec: node -p -e "process.versions.v8"

System's architecture:

$exec: uname -p

Retrieve list of AWS S3 buckets via aws & jq CLI:

$exec:
  command: aws s3api list-buckets --output json | jq -r '.Buckets'
  parseOutput: true

Note: When possible, we encourage you to build a dedicated extension to better support features you are looking for (and help out the community). eg. $aws directive instead of the above.

Installing

Install and use:

yarn add @app-config/exec

In .app-config.meta.yml file:

parsingExtensions:
  - '@app-config/exec'

Options

The following options can be passed to each $exec directive:

$exec:
  command: echo Hello World!
  trimWhitespace: true
  parseOutput: false
  failOnStderr: false

command: string:

The command to run. Should be a single string containing both command and arguments. The command's stdout will be used as the resulting value. Runs in a shell, /bin/sh on Unix and process.env.ComSpec on Windows.

trimWhitespace: boolean:

If true, automatically trim whitespace from the start and end of the command's output. Useful to remove the trailing newline produced by most commands. If false, output will be left in its raw form. Default true.

parseOutput: boolean:

If true, automatically guess output content type (YAML, TOML, JSON, or JSON5) and parse. Throws if parse fails. If false, output will be read as a string. Default false.

failOnStderr: boolean:

If true, fail if any output is found in command's stderr. Default false.

2.9.0-beta.1

11 months ago

2.8.7

1 year ago

2.8.6

1 year ago

2.8.5

2 years ago

2.8.3

2 years ago

2.8.4

2 years ago

2.8.2

2 years ago

2.8.1

3 years ago

3.0.0-alpha.6

3 years ago

2.8.0

3 years ago

2.7.2

3 years ago

2.7.1

3 years ago

2.7.0

3 years ago

2.6.1

3 years ago

2.6.0

3 years ago

2.5.2

3 years ago

2.4.6

3 years ago

2.5.0

3 years ago

2.5.1

3 years ago

3.0.0-alpha.4

3 years ago

3.0.0-alpha.3

3 years ago

3.0.0-alpha.1

3 years ago

3.0.0-alpha.2

3 years ago

2.4.5

3 years ago

2.4.4

3 years ago

2.4.3

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.4.2

3 years ago

2.3.4

3 years ago

2.3.3

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.2.2

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago