Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
DRY in specification of different deployment environments
Browse files Browse the repository at this point in the history
  • Loading branch information
lloyd committed Aug 17, 2011
1 parent dfcdde3 commit aa36950
Showing 1 changed file with 34 additions and 38 deletions.
72 changes: 34 additions & 38 deletions libs/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,48 +56,44 @@ exports.get = function(val) {
return g_config[val];
}

var defaultHostedDatabaseConfig = {
driver: "mysql",
user: 'browserid'
};
// *** the various deployment configurations ***
const g_configs = { };

// various deployment configurations
const g_configs = {
production: {
hostname: 'browserid.org',
port: '443',
scheme: 'https',
use_minified_resources: true,
log_path: '/home/browserid/var/',
database: defaultHostedDatabaseConfig
},
development: {
hostname: 'dev.diresworb.org',
port: '443',
scheme: 'https',
use_minified_resources: true,
log_path: '/home/browserid/var/',
database: defaultHostedDatabaseConfig
},
beta: {
hostname: 'diresworb.org',
port: '443',
scheme: 'https',
use_minified_resources: true,
log_path: '/home/browserid/var/',
database: defaultHostedDatabaseConfig
},
local: {
hostname: '127.0.0.1',
port: '10002',
scheme: 'http',
email_to_console: true, // don't send email, just dump verification URLs to console.
use_minified_resources: false,
log_path: path.join(__dirname, "..", "var", "logs"),
database: { driver: "json" }
// production is the configuration that runs on our
// public service (browserid.org)
g_configs.production = {
hostname: 'browserid.org',
port: '443',
scheme: 'https',
use_minified_resources: true,
log_path: '/home/browserid/var/',
database: {
driver: "mysql",
user: 'browserid'
}
};

// beta (diresworb.org) the only difference from production
// is the hostname
g_configs.beta = JSON.parse(JSON.stringify(g_configs.production));
g_configs.beta.hostname = 'diresworb.org';

// development (dev.diresworb.org) the only difference from production
// is, again, the hostname
g_configs.dev = JSON.parse(JSON.stringify(g_configs.production));
g_configs.dev.hostname = 'dev.diresworb.org';

// local development configuration
g_configs.local = {
hostname: '127.0.0.1',
port: '10002',
scheme: 'http',
email_to_console: true, // don't send email, just dump verification URLs to console.
use_minified_resources: false,
log_path: path.join(__dirname, "..", "var", "logs"),
database: { driver: "json" }
};

// default deployment is local
if (undefined === process.env['NODE_ENV']) {
process.env['NODE_ENV'] = 'local';
Expand Down

0 comments on commit aa36950

Please sign in to comment.