Skip to content

Commit 34d9c93

Browse files
authored
Avoid exporting environment variables (#16)
This change affects Netlify functions which are deployed to Nimbella instead. The environment variables will need to be explicitly declared instead of capturing the entire environment.
1 parent c978a37 commit 34d9c93

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

index.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,14 @@ async function deployProject(run) {
2727
* @param {function} run - function provided under utils by Netlify to build event functions.
2828
* @param {string} functionsDir - Path to the actions directory.
2929
*/
30-
async function deployActions({
31-
run,
32-
functionsDir,
33-
secretsPath,
34-
timeout,
35-
memory
36-
}) {
30+
async function deployActions({run, functionsDir, timeout, memory}) {
3731
const files = await readdir(functionsDir);
3832
for (const file of files) {
3933
const [actionName, extension] = file.split('.');
4034
let command =
4135
`nim action update ${actionName} ${join(functionsDir, file)} ` +
4236
`--timeout=${Number(timeout)} --memory=${Number(memory)} ` +
43-
`--web=raw --env-file=${secretsPath} `;
37+
`--web=raw `;
4438

4539
if (extension === 'js') {
4640
command += '--kind nodejs-lambda:10 --main handler';
@@ -117,13 +111,6 @@ module.exports = {
117111
try {
118112
const {stdout: namespace} = await utils.run.command(`nim auth current`);
119113

120-
// Create env.json
121-
const envs = {...process.env};
122-
// Remove CI related variables.
123-
delete envs.NETLIFY;
124-
delete envs.CI;
125-
await writeFile('env.json', JSON.stringify(envs));
126-
127114
if (isProject) {
128115
await deployProject(utils.run);
129116
}
@@ -132,7 +119,6 @@ module.exports = {
132119
await deployActions({
133120
run: utils.run,
134121
functionsDir: functionsBuildDir,
135-
secretsPath: join(process.cwd(), 'env.json'),
136122
timeout: config.nimbella.timeout || 6000, // Default is 10 seconds
137123
memory: config.nimbella.memory || 256 // Default is 256MB (max for free tier)
138124
});

0 commit comments

Comments
 (0)