Example #1
0
 private static void ConfigEnvironmentVariable(UrlTemplate urlTemplate)
 {
     if (urlTemplate.ClearData)
     {
         logger.Info("Clearing environment variable HTTP_PROXY and HTTPS_PROXY for current user");
         EnvironmentVariables.ClearHttpProxy(EnvironmentVariableTarget.User);
         EnvironmentVariables.ClearHttpsProxy(EnvironmentVariableTarget.User);
     }
     else
     {
         // Configure environment variables
         logger.Info("Setting environment variable HTTP_PROXY and HTTPS_PROXY for current user");
         logger.Info("A lot of applications such as: Ruby Gem, Ionic, Cordova, etc will be work with this configuration");
         if (urlTemplate.MustBeAuthenticated)
         {
             EnvironmentVariables.SetHttpProxy(urlTemplate.GetProxy(), EnvironmentVariableTarget.User);
             EnvironmentVariables.SetHttpsProxy(urlTemplate.GetProxySsl(), EnvironmentVariableTarget.User);
         }
         else
         {
             EnvironmentVariables.SetHttpProxy(urlTemplate.GetProxy(), EnvironmentVariableTarget.User);
             EnvironmentVariables.SetHttpsProxy(urlTemplate.GetProxySsl(), EnvironmentVariableTarget.User);
         }
     }
 }