Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- // serve/datasources.local.js
- var mongodbUri = require('mongodb-uri');
- var URI = process.env.MONGODB_URI;
- var uriObject = URI ? mongodbUri.parse(URI) : null;
- var config = {};
- if (uriObject && uriObject.hosts.length >= 1) {
- config.db = {
- name: 'db',
- connector: 'mongodb',
- host: uriObject.hosts[0].host,
- port: uriObject.hosts[0].port,
- database: uriObject.database,
- username: uriObject.username,
- password: uriObject.password,
- };
- }
- module.exports = config;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement