Skip to content

Instantly share code, notes, and snippets.

@cray0000
Last active December 27, 2015 17:59
Show Gist options
  • Save cray0000/7366342 to your computer and use it in GitHub Desktop.
Save cray0000/7366342 to your computer and use it in GitHub Desktop.
Derby.js Pass env var to the client
// Somewhere in the /lib/app
derby = require('derby');
app = require('./index.js');
if(derby.util.isServer) {
fnEval = "(function(){"
+ "return function() {"
+ "window.NODE_ENV = \'" + (process.env.NODE_ENV || 'development') + "\';"
+ "window.APP = \'" + (process.env.APP || 'myapp') + "\';"
+ "};"
+ "})()";
app.view.inline( eval(fnEval) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment