Skip to content

Instantly share code, notes, and snippets.

@electblake
Last active August 30, 2015 15:21
Show Gist options
  • Select an option

  • Save electblake/2e657da02a6422d986b6 to your computer and use it in GitHub Desktop.

Select an option

Save electblake/2e657da02a6422d986b6 to your computer and use it in GitHub Desktop.
var schema = {
/**
* @property DEBUG
*/
DEBUG: {
env: 'DEBUG',
type: 'string',
default: 'none'
},
/**
* @property PUBLIC_URL
* @example http://localhost:3000
* @example http://app-name.com
* @description Used to generate share urls, and other links serverside that should link to proper front-end url
*/
PUBLIC_URL: {
env: 'PUBLIC_URL',
type: 'string',
require: true
},
SECRET_SALT: {
env: 'SECRET_SALT',
type: 'string'
},
/**
* @property <a name="redis"></a>REDIS_URI
* @example localhost
* @description Redis is used for sessions primarily
*/
REDIS_URI: {
env: 'REDIS_URI',
type: 'string',
required: true
},
MONGO_URI: {
env: 'MONGO_URI',
type: 'string',
required: true
},
/**
* @property PORT
* @description Define express HTTP port
*/
PORT: {
env : 'PORT',
type : 'integer',
default : '9000',
required : true,
},
/**
* @property NODE_ENV
*/
NODE_ENV: {
env: 'NODE_ENV',
type: 'string',
default: 'development',
required: true
}
};
var config = require('12factor-dotenv');
var cfg = config(schema, { debug: true });
process.env.DEBUG = cfg.DEBUG;
module.exports = exports = cfg;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment