ex-yaml
CLI tool to extract values from a YAML file.
Useful for setting environment variables from YAML.
Installation
yarn add ex-yaml
Usage
Format:
ex-yaml <file> <name>
Sample usage with yarn:
PORT=$(yarn -s ex-yaml ./config.yaml my_port) ...
(Note the -s
(--silent
) flag, otherwise yarn's output will interfere.)
Equivalent result:
PORT=3000 ...
Example YAML file (config.yaml):
my_port: 3000