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

1.0.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @liryc/yaml-config

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

6.54 kB

Total Files

9

Last publish

Collaborators

  • liryc