Fix minor spacing issues
This commit is contained in:
parent
f4dbcb9b12
commit
9acb178280
3 changed files with 14 additions and 18 deletions
|
@ -2,32 +2,28 @@
|
||||||
|
|
||||||
var nconf = require('nconf');
|
var nconf = require('nconf');
|
||||||
|
|
||||||
//Load arguments as highest priority
|
// Load arguments as highest priority
|
||||||
nconf.argv(require('./arguments'));
|
nconf.argv(require('./arguments'));
|
||||||
|
|
||||||
//Overrides
|
// Overrides
|
||||||
var overrides = {};
|
var overrides = {};
|
||||||
|
|
||||||
if (nconf.get('prod')) {
|
if (nconf.get('prod')) {
|
||||||
overrides.NODE_ENV = 'production';
|
overrides.NODE_ENV = 'production';
|
||||||
}
|
} else if (nconf.get('debug')) {
|
||||||
else if (nconf.get('debug')) {
|
|
||||||
overrides.NODE_ENV = 'development';
|
overrides.NODE_ENV = 'development';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load overrides as second priority
|
// Load overrides as second priority
|
||||||
nconf.overrides(overrides);
|
nconf.overrides(overrides);
|
||||||
|
|
||||||
|
// Load enviroment variables as third priority
|
||||||
//Load enviroment variables as third priority
|
|
||||||
nconf.env();
|
nconf.env();
|
||||||
|
|
||||||
|
// Load the config if it exists.
|
||||||
//Load the config if it exists.
|
|
||||||
nconf.file(nconf.get('config') || './config.json');
|
nconf.file(nconf.get('config') || './config.json');
|
||||||
|
|
||||||
|
// Default variables
|
||||||
//Default variables
|
|
||||||
nconf.defaults({
|
nconf.defaults({
|
||||||
name: nconf.get('name') || 'spserver',
|
name: nconf.get('name') || 'spserver',
|
||||||
NODE_ENV: 'development',
|
NODE_ENV: 'development',
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
var _ = require('lodash');
|
|
||||||
var nStatic = require('node-static');
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
|
var _ = require('lodash');
|
||||||
|
var nStatic = require('node-static');
|
||||||
|
|
||||||
var config = require('./config');
|
var config = require('./config');
|
||||||
var logger = require('./logger');
|
var logger = require('./logger');
|
||||||
|
|
|
@ -4,19 +4,19 @@ var fs = require('fs');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
|
|
||||||
describe('spserver', function() {
|
describe('spserver', function () {
|
||||||
|
|
||||||
var spserver = require('../lib/spserver');
|
var spserver = require('../lib/spserver');
|
||||||
|
|
||||||
describe('#generateBase()', function() {
|
describe('#generateBase()', function () {
|
||||||
it('should return null when file is empty', function() {
|
it('should return null when file is empty', function () {
|
||||||
assert.strictEqual(null, spserver.generateBase());
|
assert.strictEqual(null, spserver.generateBase());
|
||||||
assert.strictEqual(null, spserver.generateBase(null, {}));
|
assert.strictEqual(null, spserver.generateBase(null, {}));
|
||||||
assert.strictEqual(null, spserver.generateBase(''));
|
assert.strictEqual(null, spserver.generateBase(''));
|
||||||
assert.strictEqual(null, spserver.generateBase('', {}));
|
assert.strictEqual(null, spserver.generateBase('', {}));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should read file contents if string', function() {
|
it('should read file contents if string', function () {
|
||||||
var stub = sinon.stub(fs, 'readFileSync').returns('bla');
|
var stub = sinon.stub(fs, 'readFileSync').returns('bla');
|
||||||
|
|
||||||
spserver.generateBase('asdf', {});
|
spserver.generateBase('asdf', {});
|
||||||
|
@ -24,7 +24,7 @@ describe('spserver', function() {
|
||||||
stub.restore();
|
stub.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return function if file is javascript', function() {
|
it('should return function if file is javascript', function () {
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var nothing = require('./nothing');
|
var nothing = require('./nothing');
|
||||||
var test = spserver.generateBase(path.resolve('test/nothing.js'), {});
|
var test = spserver.generateBase(path.resolve('test/nothing.js'), {});
|
||||||
|
|
Loading…
Reference in a new issue