@liryc/yaml-config
v1.0.2
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 @liryc/yaml-config
yarn add @liryc/yaml-config
bower install @liryc/yaml-config --save
Usage
Assuming the following Yaml file
databaseUrl: test
sharedKey: ${ SHARED_KEY || shared_key }
Javascript
const yml = require('@liryc/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 '@liryc/yaml-config';
console.log(parseFile('./', 'test.yml'));
console.log(parseFileToCommandLine('./', 'test.yml'));