config-yaml
v1.1.6
Published
YAML configuration for NodeJS
Downloads
8,327
Readme
config-yaml
YAML configuration for NodeJS
Basic example
config/default.yml:
foo: "bar"
list:
- 1
- 2
- 3import configYaml from "config-yaml";
const config = configYaml(`${__dirname}/config/default.yml`);
console.log(config.foo); // "bar"
console.log(config.list[1]); // 2Example 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.ymlAvailable variables
| Variable | Description |
| -------------- | --------------------------------------- |
| %__dirname% | Directory path of the current YAML file |
| %__filename% | Current YAML file path |
