@folk-org/yaml-config
v1.1.6
Published
Load yaml configuration file with environment support
Downloads
5
Readme
yaml-config
A Node.js module that load configuration from Yaml file. Files can be templated with environment variables.
Installation
npm install @folk-org/yaml-config
yarn add @folk-org/yaml-config
bower install @folk-org/yaml-config --save
Usage
Assuming the following Yaml file
databaseUrl: test
sharedKey: ${ SHARED_KEY || shared_key }
Javascript
const yml = require('@folk-org/yaml-config');
console.log(yml.parseFile('./', 'test.yml'));
console.log(yml.parseFileToCommandLine('./', 'test.yml'));
Output should be
{ databaseUrl: 'test',
authenticationSharedKey: 'shared_key' }
'databaseUrl=\'\' authenticationSharedKey=\'shared_key\''
If environment variable SHARED_KEY is defined with value secretValue
Output should be
{ databaseUrl: 'test',
authenticationSharedKey: 'secretValue' }
TypeScript
import { parseFile, parseFileToCommandLine } from '@folk-org/yaml-config';
console.log(parseFile('./', 'test.yml'));
console.log(parseFileToCommandLine('./', 'test.yml'));