Commit fff5dafb authored by Eric Betts's avatar Eric Betts

go back to putting .env into source dir

parent fa8f0dad
'use strict'
if (false) { require('./.env') } // Make Netlify include in deploy
const dotenv = require('dotenv')
const result = dotenv.config({path: './src/.env'})
const result = dotenv.config()
if (result.error) {
console.log('dotenv error:', result.error)
}
......
......@@ -4,17 +4,14 @@ module.exports = {
onPreBuild: ({ constants }) => {
console.log('Hello world from onPreBuild event!')
const { FUNCTIONS_DIST, FUNCTIONS_SRC } = constants;
console.log('functions dist', fs.readdirSync(FUNCTIONS_DIST));
const keys = Object.keys(process.env);
const kvs = keys.map(key => `${key}=${process.env[key]}`);
fs.mkdirSync(FUNCTIONS_DIST);
fs.writeFileSync(`${FUNCTIONS_DIST}/.env`, kvs.join('\n'));
console.log(`Wrote ${kvs.length} envs to ${FUNCTIONS_DIST}/.env`);
fs.writeFileSync(`${FUNCTIONS_SRC}/.env`, kvs.join('\n'));
console.log(`Wrote ${kvs.length} envs to ${FUNCTIONS_SRC}/.env`);
},
onPostBuild: ({ constants }) => {
const { FUNCTIONS_DIST, FUNCTIONS_SRC } = constants;
console.log('Hello world from onPostBuild event!')
const { FUNCTIONS_DIST, FUNCTIONS_SRC } = constants;
console.log('functions dist', fs.readdirSync(FUNCTIONS_DIST));
},
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment