Skip to content

support custom dotenv path #613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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