Skip to content

Commit

Permalink
feat(config): support custom dotenv path
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Henderson <jared@netrivet.com>
  • Loading branch information
jaredh159 committed May 17, 2019
1 parent b03c3f0 commit aef82c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var log = require('db-migrate-shared').log;
require('pkginfo')(module, 'version'); // jshint ignore:line
var Promise;
var onComplete = load('on-complete');
var config = require('rc')('db-migrate');

// constant hooks for this file
var APIHooks = {
Expand Down Expand Up @@ -37,9 +38,12 @@ function dbmigrate (plugins, isModule, options, callback) {
this.internals.dbm = require('./');
this.dataType = this.internals.dbm.dataType;
this.version = this.internals.dbm.version;
dotenv.load({
silent: true
});

var dotenvConfig = { silent: true };
if (config.dotenvCustomPath) {
dotenvConfig.path = config.dotenvCustomPath;
}
dotenv.load(dotenvConfig);

/* $lab:coverage:off$ */
if (!options || !options.throwUncatched) load('helper/register-events')();
Expand Down

0 comments on commit aef82c3

Please sign in to comment.