Print Environment Variables
Steps
- Create a new project and name it
env-vars
. - Select the project folder and open the pop-up menu.
- Choose New -> JavaScript Service.
- Give it a meaningful name (e.g
print-env-vars.js
). -
Replace the generated code in
print-env-vars.js
with the following:var env = require("core/v4/env"); var response = require("http/v4/response"); var envVarsList = JSON.parse(env.list()); var envVarValue; for (var envVarName in envVarsList) { envVarValue = envVarsList[envVarName]; response.println(envVarName + "=" + envVarValue); } response.flush(); response.close();
For more information, see the API documentation.