var rootDir = process.cwd();

var fs = require('fs');
// var nconf = require('nconf');
var config = require(rootDir + '/config');
var colors = require('colors');
var bcrypt = require('bcrypt');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId;


var nodeEnv = require('express')().get('env');
var configFilename = nodeEnv !== 'development' ? '/config_' + nodeEnv + '.json' : '/config.json';

var accountHelpers = require(rootDir + '/server/utils/account-helpers');

// nconf.argv().env().file({
// 	file: process.env.configFile || rootDir + configFilename
// });

var _db;
var _userModel;
var _superAdminUser;

_db = mongoose.createConnection(config.get('MONGO_URL'));
_db.on('error', console.error.bind(console, ' CONNECTION ERROR: '.red.inverse));
_db.once('open', function() {
	console.log('MongoDB connection opened...'.green);
	_userModel = require(rootDir + '/models/user-model')(mongoose, _db, Schema, ObjectId);
	_db.collections['users'].drop(function(error) {
		bcrypt.genSalt(10, function(err, salt) {
			bcrypt.hash('temp', salt, function(err, hash) {
				_superAdminUser = new _userModel({
					firstName: 'Super',
					lastName: 'Admin',
					password: hash,
					email: 'temp',
					role: 'superadmin'
				});
				_superAdminUser.save(function(err) {
					if(err) {
						console.error('Error creating new super admin user.'.red);
						process.exit();
					} else {
						console.log('\n   * * * * * * * * * * * *   Super Admin Saved   * * * * * * * * * * * *\n'.green);
						mongoose.connection.close(function() {
							console.log('MongoDB connection closed...'.green);
							process.exit();
						});
					}
				});
			});
		});
	});
});
@@ -47,19 +47,16 @@
 ('fs');%0A
-// 
 var ncon
@@ -81,51 +81,8 @@
 ');%0A
-var config = require(rootDir + '/config');%0A
 var 
@@ -461,19 +461,16 @@
 ers');%0A%0A
-// 
 nconf.ar
@@ -487,19 +487,16 @@
 .file(%7B%0A
-// 
 %09file: p
@@ -549,11 +549,8 @@
 ame%0A
-// 
 %7D);%0A
@@ -597,16 +597,53 @@
 nUser;%0A%0A
+console.log(nconf.get('MONGO_URL'));%0A
 _db = mo
@@ -666,22 +666,21 @@
 nection(
+n
 conf
-ig
 .get('MO

test boot again?