Saves process.env variables to a file called env.json
npm install grunt-save-env> Saves process.env variables to a file.
There are tons of modules for loading and setting proces.env variables, but none (that I could find) for save them! We use this module to save data from Jenkins builds, for example BUILD_NUMBER and BUILD_NAME.
~0.4.5If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
``shell`
npm install grunt-save-env --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-save-env');
to the data object passed into grunt.initConfig().
`
grunt.initConfig({
save_env: {
dest: 'env.json',
only: [],
exclude: []
},
});
`$3
####
dest
String, will be the filename to write. Must be json file. Defaults to env.json. This will not conflict with apps that load from .env. ####
only
Array, will parse the process.env variables and return only those specified in array. ####
exclude` - Proper tests