Skip to content

Commit

Permalink
fix: overwrite env variables when changed
Browse files Browse the repository at this point in the history
issue #42
  • Loading branch information
exreplay committed Jun 8, 2019
1 parent a9ebaad commit c266358
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { getAverjsConfig } from '@averjs/config';

if (!process.env.AVER_NO_INIT) {
if (fs.existsSync(path.resolve(process.env.PROJECT_PATH, '../.env'))) {
dotenv.config();
const envConfig = dotenv.parse(fs.readFileSync(path.resolve(process.env.PROJECT_PATH, '../.env')));
for (let k in envConfig) {
process.env[k] = envConfig[k];
}
if (dotenv.error) {
throw dotenv.error;
}
Expand Down

0 comments on commit c266358

Please sign in to comment.