Skip to content

Instantly share code, notes, and snippets.

@foundrium
Created December 10, 2015 23:36
Show Gist options
  • Save foundrium/cca1ebc8a13813c73418 to your computer and use it in GitHub Desktop.
Save foundrium/cca1ebc8a13813c73418 to your computer and use it in GitHub Desktop.
diff --git a/package.json b/package.json
index eb92c7e..e4d9be6 100644
--- a/package.json
+++ b/package.json
@@ -36,6 +36,7 @@
"bootstrap-loader": "0.0.5",
"bootstrap-sass": "^3.3.6",
"classnames": "^2.2.0",
+ "dotenv": "^1.2.0",
"es6-promise": "^3.0.2",
"foreman": "^1.4.1",
"history": "^1.13.1",
diff --git a/src/actions.js b/src/actions.js
index 1ea11b0..b1df43b 100644
--- a/src/actions.js
+++ b/src/actions.js
@@ -62,7 +62,7 @@ function formatJson(json) {
export function fetchPolicies() {
return function(dispatch) {
dispatch(requestPolicies());
- return fetch(`http://localhost:8081/api/policies`)
+ return fetch(process.env.POLICY_API)
.then(response => response.json())
.then(json => formatJson(json))
.then(json =>
diff --git a/webpack.config.js b/webpack.config.js
index 25d44b6..f02b153 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,5 +1,7 @@
var webpack = require('webpack');
+require('dotenv').load();
+
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:8080',
@@ -45,10 +47,16 @@ module.exports = {
contentBase: './dist'
},
node: {
+ fs: "empty",
__dirname: true,
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
- new webpack.DefinePlugin({ "global.GENTLY": false })
+ new webpack.DefinePlugin({
+ "global.GENTLY": false,
+ "process.env": {
+ 'POLICY_API': JSON.stringify(process.env.POLICY_API)
+ }
+ })
]
};
@shanebarringer
Copy link

ahh... i see what you did there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment