Skip to content

Print Environment Variables


  1. Create a new project and name it env-vars.
  2. Select the project folder and open the pop-up menu.
  3. Choose New -> JavaScript Service.
  4. Give it a meaningful name (e.g print-env-vars.js).
  5. 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);

For more information, see the API documentation.