Skip to content

Commit

Permalink
feat(CLI): Revert from unconditional .env support
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Sep 24, 2021
1 parent 5b38232 commit 40cdb4f
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions lib/cli/conditionally-load-dotenv.js
Expand Up @@ -2,11 +2,8 @@

'use strict';

const path = require('path');
const _ = require('lodash');
const memoizee = require('memoizee');
const fileExists = require('../utils/fs/fileExists');
const logDeprecation = require('../utils/logDeprecation');

module.exports = memoizee(
async (options, configuration) => {
Expand All @@ -15,24 +12,6 @@ module.exports = memoizee(
require('./load-dotenv')(stage);
return;
}

const defaultEnvFilePath = path.resolve('.env');
const stageEnvFilePath = path.resolve(`.env.${stage}`);

const [doesStageEnvFileExists, doesDefaultEnvFileExists] = await Promise.all([
fileExists(stageEnvFilePath),
fileExists(defaultEnvFilePath),
]);

if (doesDefaultEnvFileExists || doesStageEnvFileExists) {
logDeprecation(
'LOAD_VARIABLES_FROM_ENV_FILES',
'Detected ".env" files. In the next major release variables from ".env" ' +
'files will be automatically loaded into the serverless build process. ' +
'Set "useDotenv: true" to adopt that behavior now.',
{ serviceConfig: configuration }
);
}
},
{
length: 0 /* Intentionally no "promise: true" as rejection means critical non-retryable error */,
Expand Down

0 comments on commit 40cdb4f

Please sign in to comment.