# all files / keystone/lib/core/ initDatabase.js

28.57% Statements 2/7
0% Branches 0/12
0% Functions 0/1
28.57% Lines 2/7

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    181×

    1×

     var utils = require('keystone-utils');

    module.exports = function initDatabase () {
    	if (!this.get('mongo')) {
    		var dbName = this.get('db name')
    			|| utils.slug(this.get('name'));
    		var dbUrl = process.env.MONGO_URI
    			|| process.env.MONGO_URL
    			|| process.env.MONGODB_URL
    			|| process.env.MONGOLAB_URI
    			|| process.env.MONGOLAB_URL
    			|| (process.env.OPENSHIFT_MONGODB_DB_URL
    			|| 'mongodb://localhost/') + dbName;
    		this.set('mongo', dbUrl);
    	}
    	return this;
    };