diff --git a/lib/config.js b/lib/config.js index 9ea9cf0..4aa01e9 100644 --- a/lib/config.js +++ b/lib/config.js @@ -2,32 +2,28 @@ var nconf = require('nconf'); -//Load arguments as highest priority +// Load arguments as highest priority nconf.argv(require('./arguments')); -//Overrides +// Overrides var overrides = {}; if (nconf.get('prod')) { overrides.NODE_ENV = 'production'; -} -else if (nconf.get('debug')) { +} else if (nconf.get('debug')) { overrides.NODE_ENV = 'development'; } -//Load overrides as second priority +// Load overrides as second priority nconf.overrides(overrides); - -//Load enviroment variables as third priority +// Load enviroment variables as third priority nconf.env(); - -//Load the config if it exists. +// Load the config if it exists. nconf.file(nconf.get('config') || './config.json'); - -//Default variables +// Default variables nconf.defaults({ name: nconf.get('name') || 'spserver', NODE_ENV: 'development', diff --git a/lib/spserver.js b/lib/spserver.js index 2e7fd7f..b7cb21c 100644 --- a/lib/spserver.js +++ b/lib/spserver.js @@ -2,10 +2,10 @@ var fs = require('fs'); var http = require('http'); -var _ = require('lodash'); -var nStatic = require('node-static'); var path = require('path'); +var _ = require('lodash'); +var nStatic = require('node-static'); var config = require('./config'); var logger = require('./logger'); diff --git a/test/base.test.js b/test/base.test.js index 93cd57c..f4f7ad2 100644 --- a/test/base.test.js +++ b/test/base.test.js @@ -4,19 +4,19 @@ var fs = require('fs'); var assert = require('assert'); var sinon = require('sinon'); -describe('spserver', function() { +describe('spserver', function () { var spserver = require('../lib/spserver'); - describe('#generateBase()', function() { - it('should return null when file is empty', function() { + describe('#generateBase()', function () { + it('should return null when file is empty', function () { assert.strictEqual(null, spserver.generateBase()); assert.strictEqual(null, spserver.generateBase(null, {})); 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'); spserver.generateBase('asdf', {}); @@ -24,7 +24,7 @@ describe('spserver', function() { 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 nothing = require('./nothing'); var test = spserver.generateBase(path.resolve('test/nothing.js'), {});