Skip to content

Commit

Permalink
Rename whitelist to allowList
Browse files Browse the repository at this point in the history
  • Loading branch information
chadly committed Jul 14, 2020
1 parent 6062554 commit e2c09ca
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gatsby Environment Variables Plugin

> A [Gatsby](https://github.com/gatsbyjs/gatsby) plugin to whitelist system environment variables to be made available to client-side scripts.
> A [Gatsby](https://github.com/gatsbyjs/gatsby) plugin to allow system environment variables to be made available to client-side scripts.
By default, Gatsby only makes system environment variables [prefixed with `GATSBY_`](https://www.gatsbyjs.org/docs/environment-variables/#accessing-environment-variables-in-javascript) available to client scripts. Using this plugin, you can make any arbitrary environment variable available at runtime.

Expand All @@ -20,7 +20,7 @@ module.exports = {
{
resolve: `gatsby-plugin-env-variables`,
options: {
whitelist: ["MY_VAR", "MY_OTHER_VAR"]
allowList: ["MY_VAR", "MY_OTHER_VAR"]
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-plugin-env-variables",
"version": "1.0.2",
"description": "Gatsby plugin to whitelist system environment variables to be made available to client-side scripts",
"version": "2.0.0",
"description": "Gatsby plugin to allow system environment variables to be made available to client-side scripts",
"keywords": [
"gatsby",
"gatsby-plugin",
Expand Down
6 changes: 3 additions & 3 deletions src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
exports.onCreateWebpackConfig = ({ actions, plugins }, options) => {
const { whitelist } = options || {};
const { allowList } = options || {};

if (!whitelist) return;
if (!allowList) return;

const varobj = Object.keys(process.env).reduce((acc, key) => {
if (whitelist.indexOf(key) >= 0) {
if (allowList.indexOf(key) >= 0) {
acc[`process.env.${key}`] = JSON.stringify(process.env[key]);
}
return acc;
Expand Down

0 comments on commit e2c09ca

Please sign in to comment.