Overrides envirenment variables if needed.
550704
protected function overrideEnvironmentVariables()
    {
        if (!isset($this->options->filtered['configuration'])) {
            return;
        }

        $variables = $this->options->filtered['configuration']->getEnvironmentVariables();

        foreach ($variables as $key => $value) {
            putenv(sprintf('%s=%s', $key, $value));

            $_ENV[$key] = $value;
        }
    }
955910
def _replace_envvar(s, _):
    """"""
    e = s.split(":")
    if len(e) > 3 or len(e) == 1 or e[0] != "env":
        raise ValueError()
    elif len(e) == 2:
        # Note: this can/should raise a KeyError (according to spec).
        return os.environ[e[1]]
    else:  # len(e) == 3
        return os.environ.get(e[1], e[2])
267948
private static String replaceEnvVars(final String val) {
        String ret = val;
        final String[] envVars = StringUtils.substringsBetween(ret, "${", "}");
        if (null != envVars) {
            for (int i = 0; i < envVars.length; i++) {
                final String envKey = envVars[i];
                String envVal = System.getenv(envKey);
                if (StringUtils.isBlank(envVal)) {
                    envVal = "";
                }

                ret = StringUtils.replace(ret, "${" + envKey + "}", envVal);
            }
        }

        return ret;
    }
216165
private static EnvVars inherit(@Nonnull Map<String,String> overrides) {
        EnvVars m = new EnvVars(EnvVars.masterEnvVars);
        m.overrideExpandingAll(overrides);
        return m;
    }
19689
def config(env=DEFAULT_ENV, default=None, **overrides):
    """"""

    config = {}

    s = os.environ.get(env, default)

    if s:
        config = parse(s)

    overrides = dict([(k.upper(), v) for k, v in overrides.items()])

    config.update(overrides)

    return config
695485
def export_envars(self, env):
        """"""
        for k, v in env.items():
            self.export_envar(k, v)
247755
function strFromEnvironmentVarSetting(functionsVar, envVar) {
  if (!process.env[envVar]) {
    const msg = `${envVar} does not exist on within environment variables`
    warn(msg)
    return ''
  }
  return `${functionsVar}="${process.env[envVar]}"`
}
150509
private static void printEnvVariables() {
    System.out.println("Environment Variables: ");
    Map<String,String> map = System.getenv();
    Set<Entry<String, String>> entrySet = map.entrySet();
    for(Entry<String, String> entry : entrySet) {
      System.out.println(entry.getKey() + " = " + entry.getValue());
    }
  }
1228008
public void addEnv(final Environment.Variable var) {
    this.compilerDef.addEnv(var);
    for (int i = 0; i < this._compilers.size(); i++) {
      final CompilerDef currentCompilerDef = this._compilers.elementAt(i);
      currentCompilerDef.addEnv(var);
    }
    this.linkerDef.addEnv(var);
  }
439748
def env(self, **kw):
        '''
        
        '''
        self._original_env = kw
        if self._env is None:
            self._env = dict(os.environ)
        self._env.update({k: unicode(v) for k, v in kw.iteritems()})
        return self
769001
function overrideWithEnvironment (object, environment) {
  if (object.environments && object.environments[environment]) {
    const newObject = Object.assign(
      {},
      object,
      object.environments[environment]
    )
    delete newObject.environments
    return newObject
  }

  return object
}
513974
private function setEnvironmentOptions()
    {
        if (empty($this->environment)) {
            return;
        }

        if (is_object($this->client) && property_exists($this->client, 'environment')) {
            $this->client->environment = $this->environment;
        }
        $this->jsOptions['environment'] = $this->environment;
    }
1272275
protected function setDefaultEnvironment() {
		#Using _ENV_ and $_SERVER only as the last chance to guess the environment.
		#User can and should set the environment through constructor or setEnv($env).

		if(isset($this->params['env']))
			return;
		if(defined('_ENV_'))
			$this->params['env'] = _ENV_;
		elseif(file_exists($file = $this->params['root'].'/storage/environment'))
			$this->params['env'] = trim(file_get_contents($file));
		elseif($this->get('consoleMode')) {
			foreach($_SERVER['argv'] as $k=>$v) {
				if($v === '--env' && isset($_SERVER['argv'][$k+1])) {
					$this->params['env'] = $_SERVER['argv'][$k+1];
					return;
				}
			}
			$this->params['env'] = 'dev';
		}
		elseif(php_sapi_name() === 'cli' || (isset($_SERVER['HTTP_HOST']) && ($_SERVER['HTTP_HOST'] == '127.0.0.1' || $_SERVER['HTTP_HOST'] == 'localhost')))
			$this->params['env'] = 'dev';
		else
			$this->params['env'] = 'prod';
	}
900748
public void setEnvironmentVariables(java.util.Collection<EnvironmentVariable> environmentVariables) {
        if (environmentVariables == null) {
            this.environmentVariables = null;
            return;
        }

        this.environmentVariables = new java.util.ArrayList<EnvironmentVariable>(environmentVariables);
    }
1288925
private static void setEnv(Map<String, String> newEnv, boolean overwrite) {

		for (Entry<String, String> entry : newEnv.entrySet()) {
			if (overwrite || System.getProperty(entry.getKey()) != null) {
				System.setProperty(entry.getKey(), entry.getValue());
			}
		}

		if (!overwrite) {
			Iterator<Entry<String, String>> iterator = newEnv.entrySet().iterator();
			while (iterator.hasNext()) {
				Entry<String, String> next = iterator.next();
				if (System.getenv(next.getKey()) != null) {
					iterator.remove();
				}
			}
		}

		try {
			Class<?> processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment");
			Method variableMethod = Class.forName("java.lang.ProcessEnvironment$Variable").getMethod("valueOf", String.class);
			variableMethod.setAccessible(true);
			Method valueMethod = Class.forName("java.lang.ProcessEnvironment$Value").getMethod("valueOf", String.class);
			valueMethod.setAccessible(true);

			Map<Object, Object> newEnvVarVal = new HashMap<Object, Object>();
			for (Map.Entry<String, String> entry : newEnv.entrySet()) {
				Object key = variableMethod.invoke(null, entry.getKey());
				String valueText = entry.getValue();
				Object value = valueText != null ? valueMethod.invoke(null, valueText) : null;
				newEnvVarVal.put(key, value);
			}

			Field theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment");
			theEnvironmentField.setAccessible(true);
			Map<Object, Object> env = (Map<Object, Object>) theEnvironmentField.get(null);
			for (Entry<Object, Object> entry : newEnvVarVal.entrySet()) {
				if (entry.getValue() == null) {
					env.remove(entry.getKey());
				} else {
					env.put(entry.getKey(), entry.getValue());
				}
			}
			Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment");
			theCaseInsensitiveEnvironmentField.setAccessible(true);
			Map<Object, Object> cienv = (Map<Object, Object>) theCaseInsensitiveEnvironmentField.get(null);
			cienv.putAll(newEnvVarVal);

		} catch (NoSuchFieldException e) {
			try {
				Class[] classes = Collections.class.getDeclaredClasses();
				Map<String, String> env = System.getenv();
				for (Class cl : classes) {
					if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) {
						Field field = cl.getDeclaredField("m");
						field.setAccessible(true);
						Object obj = field.get(env);
						Map<String, String> map = (Map<String, String>) obj;
						for (Entry<String, String> entry : newEnv.entrySet()) {
							if (entry.getValue() == null) {
								map.remove(entry.getKey());
							} else {
								map.put(entry.getKey(), entry.getValue());
							}
						}
					}
				}
			} catch (Exception e2) {
				LOGGER.error(e2.getMessage(), e2);
			}
		} catch (Exception e1) {
			LOGGER.error(e1.getMessage(), e1);
		}
	}
1077507
public CreateAppRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
        setEnvironmentVariables(environmentVariables);
        return this;
    }
212673
public EnvVars overrideExpandingAll(@Nonnull Map<String,String> all) {
        for (String key : new OverrideOrderCalculator(this, all).getOrderedVariableNames()) {
            override(key, expand(all.get(key)));
        }
        return this;
    }