Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/chappio/node-properties
- Owner: ChappIO
- Created: 2019-04-21T08:30:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T20:16:31.000Z (almost 2 years ago)
- Last Synced: 2024-10-16T04:02:16.278Z (3 months ago)
- Language: TypeScript
- Size: 628 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
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)