mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-01-12 15:04:59 +08:00
14 lines
310 B
CoffeeScript
14 lines
310 B
CoffeeScript
{config} = app
|
|
{mongoose} = app.libs
|
|
|
|
{user, password, host, name} = config.mongodb
|
|
|
|
if user and password
|
|
mongodb_uri = "mongodb://#{user}:#{password}@#{host}/#{name}"
|
|
else
|
|
mongodb_uri = "mongodb://#{host}/#{name}"
|
|
|
|
module.exports = mongoose.createConnection mongodb_uri
|
|
|
|
exports.mongodb_uri = mongodb_uri
|