rsnext/examples/with-now-env/next.config.js
JJ Kasper 17da3f86ad Update with-now-env to use env config (#6581)
* Update with-now-env to use `env` config
instead of webpack.DefinePlugin

* Remove mention of DefinePlugin from index page
2019-03-08 20:41:07 +01:00

23 lines
575 B
JavaScript

/**
* After the next require you can use process.env to get your secrets
*/
if (process.env.NODE_ENV !== 'production') {
require('now-env')
}
console.log({
SECRET: process.env.SECRET,
ANOTHER_SECRET: process.env.ANOTHER_SECRET,
SECRET_FAIL: process.env.SECRET_FAIL
})
/**
* If some of the envs are public, like a google maps key, but you still
* want to keep them secret from the repo, the following code will allow you
* to share some variables with the client, configured at compile time.
*/
module.exports = {
env: {
SECRET: process.env.SECRET
}
}