https://github.com/chappio/node-properties
Modular configuration for nodejs applications
https://github.com/chappio/node-properties
Last synced: 6 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 (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T20:16:31.000Z (over 2 years ago)
- Last Synced: 2024-12-28T20:00:33.435Z (7 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
[](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)