@folk-org/yaml-config
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

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'));

Readme

Keywords

none

Package Sidebar

Install

npm i @folk-org/yaml-config

Weekly Downloads

1

Version

1.1.6

License

ISC

Unpacked Size

7.18 kB

Total Files

10

Last publish

Collaborators

  • grollec
  • sanyann
  • liryc