Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chappio/node-properties

Modular configuration for nodejs applications
https://github.com/chappio/node-properties

Last synced: 2 months ago
JSON representation

Modular configuration for nodejs applications

Awesome Lists containing this project

README

        

# node-properties

[![NPM](https://nodei.co/npm/node-properties.svg?downloads=true&downloadRank=true)](https://www.npmjs.com/package/node-properties)

Extremely flexible, no-hassle configuration for nodejs applications.

## Install

```bash
npm i node-properties
```

## Usage

*defaults.yaml*
```yaml
user:
name: John
```

*index.js*
```typescript
import {config} from 'node-properties';

const name = config.get('user.name');
console.log(`Hello ${name}!`);

// Output: Hello John!
```

## Sources

By default, properties are retrieved in the following order:

1. Command line parameters
2. Environment variables
3. `config/${NODE_ENV}` (.yaml, .json, or .env)
4. `config/defaults` (.yaml, .json, or .env)