Load .env if it set and merge with environment
774181
protected function setUpEnvironment()
    {
        $dotEnv = new Dotenv();
        $dotEnv->populate($this->getEnvironmentVars());

        $envFilePath = Path::getProjectRoot('/.env');
        if (is_readable($envFilePath)) {
            $dotEnv->load($envFilePath);
        }

        $errorLogFile = getenv('ERROR_LOG');

        /**
         * Wordpress use it to log down self errors
         */
        ini_set('error_log',Path::getProjectRoot($errorLogFile));
    }
1150390
def change_env(name, val):
    
    oldval = os.environ.get(name, None)
    os.environ[name] = val
    yield
    if oldval is None:
        del os.environ[name]
    else:
        os.environ[name] = oldval
374790
def load_env(keys=[], name='NT', use_getpass=False):
    
    NT = namedtuple(name, keys)
    if use_getpass:
        values = [os.getenv(x) or getpass.getpass(x) for x in keys]
    else:
        values = [os.getenv(x) or input(x) for x in keys]
    return NT(*values)
1091734
def add_env(parser):
    """"""
    parser.add_argument(
        '-e', '--env', choices=ENVS, default=os.getenv('ENV', default='dev'), help='Deploy environment, overrides $ENV')
899625
def getenv(option_name, default=None):
    """"""
    env = "%s_%s" % (NAMESPACE.upper(), option_name.upper())
    return os.environ.get(env, default)
805958
function load_env()
    {
        if ($this->env_loaded) {
            return;
        }

        $this->env_loaded = true;

        // Add include path for Enigma classes and drivers
        $include_path = $this->home . '/lib' . PATH_SEPARATOR;
        $include_path .= ini_get('include_path');
        set_include_path($include_path);

        // load the Enigma plugin configuration
        $this->load_config();

        // include localization (if wasn't included before)
        $this->add_texts('localization/');
    }
194331
def merge(other)
      result = Env.new
      result.env = @env.merge(other.env)
      return result
    end
518604
function EnvPacket(env) {
  Packet.call(this);
  this.env = env || {};
  this.json = JSON.stringify(this.env);
}
1010654
def load_environment_vars(self):
        
        for k, v in os.environ.items():
            if k.startswith(MACH9_PREFIX):
                _, config_key = k.split(MACH9_PREFIX, 1)
                self[config_key] = v
1196527
def get_env(path, ignore_git_branch=False):
    """"""
    if 'DEPLOY_ENVIRONMENT' in os.environ:
        return os.environ['DEPLOY_ENVIRONMENT']

    if ignore_git_branch:
        LOGGER.info('Skipping environment lookup from current git branch '
                    '("ignore_git_branch" is set to true in the runway '
                    'config)')
    else:
        # These are not located with the top imports because they throw an
        # error if git isn't installed
        from git import Repo as GitRepo
        from git.exc import InvalidGitRepositoryError

        try:
            b_name = GitRepo(
                path,
                search_parent_directories=True
            ).active_branch.name
            LOGGER.info('Deriving environment name from git branch %s...',
                        b_name)
            return get_env_from_branch(b_name)
        except InvalidGitRepositoryError:
            pass
    LOGGER.info('Deriving environment name from directory %s...', path)
    return get_env_from_directory(os.path.basename(path))
881628
def bind_to_env(self, bound_env):
        '''
        
        '''
        return self.__class__(self._scope, self._location,
                              path=self._path, host=self._host,
                              fragment=self._fragment,
                              ready=self._ready,
                              need_arguments=self._need_arguments,
                              finalize_params=self._finalize_params,
                              parent=self._parent,
                              bound_env=bound_env)
808535
def _with_env(self, env):
        """"""
        res = self._browse(env, self._ids)
        return res
993239
def add_env(url, saltenv):
    '''
    
    '''
    if not url.startswith('salt://'):
        return url

    path, senv = parse(url)
    return create(path, saltenv)
780827
def environ_setenv(self, tag, data):
        '''
        
        '''
        environ = data.get('environ', None)
        if environ is None:
            return False
        false_unsets = data.get('false_unsets', False)
        clear_all = data.get('clear_all', False)
        import salt.modules.environ as mod_environ
        return mod_environ.setenv(environ, false_unsets, clear_all)
802100
private function setEnvironment($env) {
    if (isset($this->environments[$env])) {
      $this->loadEnvironment($env);
      return TRUE;
    }
    else {
      return FALSE;
    }
  }
162671
public function loadEnv() {
        $ed = $this->loadEnvDefault();
        $ej = $this->loadEnvJson();
        
        if(!$ed && !$ej ) {
            $msg = "No configuration files found.";
            $this->error($msg);
            die($msg);
        }
    }
1002347
def load_env(print_vars=False):
    
    env_file = os.environ.get('ENV_FILE', '.env')
    try:
        variables = open(env_file).read().splitlines()
        for v in variables:
            if '=' in v:
                key, value = v.split('=', 1)
                if key.startswith('#'):
                    continue
                if key not in os.environ:
                    if value.startswith('"') and value.endswith('"') or \
                                    value.startswith("'") and value.endswith("'"):
                        os.environ[key] = ast.literal_eval(value)
                    else:
                        os.environ[key] = value
                    if print_vars:
                        print(key, os.environ[key])
    except IOError:
        pass