config-yaml
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/config-yaml package

1.1.6 • Public • Published

Node version Version Build status dependencies Status devDependencies Status

config-yaml

YAML configuration for NodeJS

Basic example

config/default.yml:

foo: "bar"
list:
    - 1
    - 2
    - 3
import configYaml from "config-yaml";
 
const config = configYaml(`${__dirname}/config/default.yml`);
 
console.log(config.foo); // "bar"
console.log(config.list[1]); // 2

Example with imports directive

config/production.yml:

imports:
    { resource: "default.yml" }
    { resource: "routing/api.yml", property: "routing.api" }
 
foo: "hello"
tic: "tac"
import configYaml from "config-yaml";
 
const config = configYaml(`${__dirname}/config/production.yml`);
 
console.log(config.foo); // "hello"
console.log(config.routing.api); // Configuration from routing/api.yml

Available variables

Variable Description
%__dirname% Directory path of the current YAML file
%__filename% Current YAML file path

Readme

Keywords

none

Package Sidebar

Install

npm i config-yaml

Weekly Downloads

2,716

Version

1.1.6

License

MIT

Unpacked Size

6.94 kB

Total Files

4

Last publish

Collaborators

  • neolao