1.0.0 • Published 7 years ago

sweet-config v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

Introduction

Sweet config load file/directory configuration for you, it handle env configuration in an fixed way.

Quick Start

Only support js/json file formats Install in your app directory

npm install sweet-config
mkdir config
vi config/application.json
mkdir config/env
vi config/env/development.js
vi config/env/production
// application.json
{
  "keys": ["abc", 'def']
}
// env/development.js
module.exports = {
  database: {
    host: 'localhost'
  }
}
// env/production
module.exports = {
  database: {
    host: '127.0.0.1'
  }
}
const config = require('sweet-config')
config.load() // if not give directory or file path, will load `config` directory in project root
config.get('application.keys') // should equals to ['abc', 'def']
// sweet config will load env configuration in root
config.get('database') // should equals to {host: '127.0.0.1'} when NODE_ENV=production
1.0.0

7 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago