New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

envgrabber

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

envgrabber - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

5

.eslintrc.json

@@ -20,7 +20,4 @@ {

"sourceType": "module",
"ecmaVersion": 2017,
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
"ecmaVersion": 2019
}
}

1

cli.js

@@ -19,3 +19,2 @@ #!/usr/bin/env node

await envGrabber({ bucketName, fileName });
console.log('Environment variables file successfully downloaded');
} catch (error) {

@@ -22,0 +21,0 @@ console.log(error.message);

'use strict';
const gcs = require('@google-cloud/storage')();
const byline = require('byline');

@@ -15,8 +16,27 @@ /**

function envGrabber({ bucketName, fileName = '.env' }) {
return gcs
.bucket(bucketName)
.file(fileName)
.download({ destination: fileName });
return new Promise(async resolve => {
const result = [];
const file = await gcs
.bucket(bucketName)
.file(fileName)
.createReadStream();
const lineStream = byline.createStream(file);
lineStream.on('data', line => {
const [key, value] = line
.toString()
.replace(/"|'/g, '')
.split('=');
result.push(key);
process.env[key] = value;
});
lineStream.on('end', () => {
console.log(
`The following environment variables were set: ${result.join(', ')}`,
);
resolve();
});
});
}
module.exports = envGrabber;
{
"name": "envgrabber",
"license": "MIT",
"version": "0.0.2",
"version": "0.0.3",
"description": "A tool to retrieve .env files from a Google Storage bucket before deployment",

@@ -17,2 +17,3 @@ "devDependencies": {

"@google-cloud/storage": "^1.7.0",
"byline": "^5.0.0",
"yargs": "^11.0.0"

@@ -19,0 +20,0 @@ },

<h1 align="center"> envGrabber </h1>
<p align="center">
<b >A simple script to pull environment variables from a GCP Storage bucket. Designed to work with Google App Engine out of the box</b>
<b >A simple script to pull environment variables from a GCP Storage bucket a sets them in your app. Designed to work with Google App Engine out of the box</b>
</p>

@@ -23,6 +23,9 @@ <br>

await envGrabber({
bucketName: 'my_super_secret_bucket',
fileName: '.env', // optional, '.env' is assumed.
});
(async () => {
await envGrabber({
bucketName: 'my_super_secret_bucket',
fileName: '.env', // optional, '.env' is assumed.
});
})()
````

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc