Skip to content

Commit

Permalink
Add docs file for environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
okcoker committed Jul 12, 2017
1 parent eee5212 commit 520b8d6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/docs/environment-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "Environment Variables"
---

You can easily provide environment variables to your site. Just add a `.env.development` and/or `.env.production` file in your root folder for development or production builds respectively. The environment variables are embedded during build time using Webpack's [DefinePlugin](https://webpack.js.org/plugins/define-plugin/). Because these variables are provided at build time, you will need restart your dev server or rebuild your site after changing them.

## Example

```
# Example .env.development file
API_URL=https://dev.example.com/api
```

```
# Example .env.production file
API_URL=https://example.com/api
```

These variables will be available to your site as `process.env.API_URL`.

> You can not override certain environment variables as some are used internally for optimizations during build
Reserved environment variables:

- `NODE_ENV`
- `PUBLIC_DIR`

0 comments on commit 520b8d6

Please sign in to comment.