Skip to content

Commit

Permalink
feat: add command parameter to set custom dotenv conf (#1590)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbaum83 committed Jan 17, 2021
1 parent 2fa8937 commit b03d242
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ import {banner} from './banner';
import dotenv from 'dotenv';
import path from 'path';

if (existsSync(path.resolve(__dirname, '../dotenv'))) {
if (process.env.npm_config_conf) {
if (
existsSync(path.resolve(__dirname, '../' + process.env.npm_config_conf))
) {
dotenv.config({
path: path.resolve(__dirname, '../' + process.env.npm_config_conf)
});
} else {
dotenv.config({path: path.resolve(__dirname, '../.env')});
}
} else if (existsSync(path.resolve(__dirname, '../dotenv'))) {
dotenv.config({path: path.resolve(__dirname, '../dotenv')});
} else {
dotenv.config({path: path.resolve(__dirname, '../.env')});
Expand Down

0 comments on commit b03d242

Please sign in to comment.