apemanenv
Env settings for apeman project.
Last updated 3 years ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install apemanenv 
SYNC missed versions from official npm registry.

apemanenv

Build Status npm Version JS Standard

Env settings for apeman project.

Load environment specific settings , using konfig.

Installation

$ npm install apemanenv --save

Usage

Create a directory with name "env" and put env setting files like "database.json" there.

env/database.json

{
  "default": {
    "HOST": "localhost",
    "SHCEMA": "myapp",
    "USER": "myapp-db-user",
    "PASSWORD": "password-of-#{USER}"
  },
  "production": {
    "HOST": "http://myapp-db.com",
    "USER": "myapp-db-user-production",
    "PASSWORD": "a;skdjfasdwer"
  },
  "development": {
    "USER": "myapp-db-user-dev",
    "PASSWORD": "myapp-db-user-dev"
  }
}

env/index.js

'use strict'

const apemanenv = require('apemanenv')

let env = apemanenv(__dirname, {
  overridable: false
})

// Exports env settings as module.
module.exports = env

if (!module.parent) {
  // Print env settings to console.
  env.print()
}

Tips

Overriding variables from process.env

You can override values with process.env values when overridable option is true.

For example,

$ DATABASE_PASSWORD="as09u123;" ./main.js

This overrides "PASSWORD" field in env/database.json

License

This software is released under the MIT License.

Links

Current Tags

  • 4.2.3                                ...           latest (3 years ago)

30 Versions

  • 4.2.3                                ...           3 years ago
  • 4.2.2                                ...           3 years ago
  • 4.2.1                                ...           3 years ago
  • 4.2.0                                ...           3 years ago
  • 4.1.1                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 3.0.6                                ...           3 years ago
  • 4.0.1                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.5                                ...           4 years ago
  • 3.0.4                                ...           4 years ago
  • 3.0.3                                ...           4 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.1.4                                ...           4 years ago
  • 2.1.3                                ...           4 years ago
  • 2.1.2                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.5                                ...           5 years ago
  • 1.0.4                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (8)

Copyright 2014 - 2016 © taobao.org |