Map getGcloudCommandEnvironment()

in appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/operations/GcloudRunner.java [121:145]


  Map<String, String> getGcloudCommandEnvironment() {
    Map<String, String> environment = Maps.newHashMap();
    if (credentialFile != null) {
      environment.put("CLOUDSDK_APP_USE_GSUTIL", "0");
    }
    if (metricsEnvironment != null) {
      environment.put("CLOUDSDK_METRICS_ENVIRONMENT", metricsEnvironment);
    }
    if (metricsEnvironmentVersion != null) {
      environment.put("CLOUDSDK_METRICS_ENVIRONMENT_VERSION", metricsEnvironmentVersion);
    }
    if (showStructuredLogs != null) {
      environment.put("CLOUDSDK_CORE_SHOW_STRUCTURED_LOGS", showStructuredLogs);
    }
    // This is to ensure IDE credentials get correctly passed to the gcloud commands, in Windows.
    // It's a temporary workaround until a fix is released.
    // https://github.com/GoogleCloudPlatform/google-cloud-intellij/issues/985
    if (System.getProperty("os.name").contains("Windows")) {
      environment.put("CLOUDSDK_APP_NUM_FILE_UPLOAD_PROCESSES", "1");
    }

    environment.put("CLOUDSDK_CORE_DISABLE_PROMPTS", "1");

    return environment;
  }