2014-02-20 03:53:49 +08:00
|
|
|
/*
|
|
|
|
* cylon configuration loader
|
|
|
|
* cylonjs.com
|
|
|
|
*
|
2014-02-28 02:58:50 +08:00
|
|
|
* Copyright (c) 2013-2014 The Hybrid Group
|
2014-02-20 03:53:49 +08:00
|
|
|
* Licensed under the Apache 2.0 license.
|
|
|
|
*/
|
|
|
|
|
2014-02-28 02:58:50 +08:00
|
|
|
'use strict';
|
2014-02-20 03:53:49 +08:00
|
|
|
|
2014-02-28 02:58:50 +08:00
|
|
|
var namespace = require('node-namespace');
|
2014-02-20 03:53:49 +08:00
|
|
|
|
2014-02-28 02:58:50 +08:00
|
|
|
var fetch = function(variable, defaultValue) {
|
|
|
|
if (defaultValue == null) {
|
|
|
|
defaultValue = false;
|
|
|
|
}
|
|
|
|
if (process.env[variable] != null) {
|
|
|
|
return process.env[variable];
|
|
|
|
} else {
|
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
};
|
2014-02-20 03:53:49 +08:00
|
|
|
|
2014-02-28 02:58:50 +08:00
|
|
|
namespace('CylonConfig', function() {
|
|
|
|
return this.testing_mode = fetch("CYLON_TEST", false);
|
|
|
|
});
|
2014-02-20 03:53:49 +08:00
|
|
|
|
2014-02-28 02:58:50 +08:00
|
|
|
module.exports = CylonConfig;
|