You are correct. The .env file is in your project folder. Did you require it in your keystone.js file?
At the top of your keystone.js file should be:
require('dotenv').load();
Also, be sure your starting directory is the same where the keystone.js file is. If you are starting KeystoneJS like this:
node ./your-project/keystone.js
You should take care about NodeJS directory change. Try to put this at the top of your keystone.js file:
console.log('Starting environment: ' + process.env.NODE_ENV);
if (process.env.HOME && process.env.NODE_ENV == 'production') {
console.log('Starting directory: ' + process.cwd());
try {
process.chdir(process.env.HOME);
console.log('New directory: ' + process.cwd());
}
catch (err) {
console.log('chdir: ' + err);
}
}
require('dotenv').load();