Created
June 12, 2017 14:43
-
-
Save leongaban/dc92204454b3513e511645af98107775 to your computer and use it in GitHub Desktop.
Get environment variable into node and create a js file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const environment = process.env.NODE_ENV; | |
const stream = fs.createWriteStream("src/services/environment.js"); | |
stream.once('open', function(fd) { | |
stream.write('const env = "'+environment+'"\n'); | |
stream.write('export default env'); | |
stream.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment