Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chadly/gatsby-plugin-env-variables
Gatsby plugin to allow system environment variables to be made available to client-side scripts
https://github.com/chadly/gatsby-plugin-env-variables
environment-variables gatsby gatsby-plugin
Last synced: about 2 months ago
JSON representation
Gatsby plugin to allow system environment variables to be made available to client-side scripts
- Host: GitHub
- URL: https://github.com/chadly/gatsby-plugin-env-variables
- Owner: chadly
- License: mit
- Created: 2019-01-23T02:50:16.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T03:27:38.000Z (almost 2 years ago)
- Last Synced: 2024-11-09T03:47:35.680Z (2 months ago)
- Topics: environment-variables, gatsby, gatsby-plugin
- Language: JavaScript
- Homepage:
- Size: 9.47 MB
- Stars: 11
- Watchers: 2
- Forks: 4
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gatsby Environment Variables Plugin
> 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.
## Install
```
npm install gatsby-plugin-env-variables
```## How to use
In `gatsby-config.js`:
```js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-env-variables`,
options: {
allowList: ["MY_VAR", "MY_OTHER_VAR"]
},
},
],
}
```This will make `MY_VAR` & `MY_OTHER_VAR` available at runtime in your app by accessing `process.env.MY_VAR` or `process.env.MY_OTHER_VAR`.