Load environment variables from '.env' file
556800
function loadEnvFile() {
	if (flags.env || flags.envfile) {
		try {
			const dotenv = require("dotenv");

			if (flags.envfile)
				dotenv.config({ path: flags.envfile });
			else
				dotenv.config();
		} catch(err) {
			throw new Error("The 'dotenv' package is missing! Please install it with 'npm install dotenv --save' command.");
		}
	}
}
881305
def from_env(key: str, default: T = None) -> Union[str, Optional[T]]:
    
    return os.getenv(key, default)
1352088
def set_env(envName, envValue):
    
    os.environ[envName] = os.environ[envName] + ':' + envValue
955490
def envs(self):
        '''
        
        '''
        load = {'cmd': '_file_envs'}
        return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \
            else self.channel.send(load)
476801
def load_dotenv(dotenv_path, verbose=False):
    
    if not os.path.exists(dotenv_path):
        if verbose:
            warnings.warn(f"Not loading {dotenv_path}, it doesn't exist.")
        return None
    for k, v in dotenv_values(dotenv_path).items():
        os.environ.setdefault(k, v)
    return True
784757
def load_cfg(path, envvar_prefix='LIBREANT_', debug=False):
    ''''''
    try:
        return load_configs(envvar_prefix, path=path)
    except Exception as e:
        if debug:
            raise
        else:
            die(str(e))
90322
def import_env(*envs):
    ''
    for env in envs:
        parts = env.split(':', 1)
        if len(parts) == 1:
            export_as = env
        else:
            env, export_as = parts
        env_val = os.environ.get(env)
        if env_val is not None:
            yield '{}={}'.format(export_as, shlex.quote(env_val))
424797
def _env(self, line):
        '''
   
        '''
        line = self._setup('ENV', line)

        # Extract environment (list) from the line
        environ = parse_env(line)

        # Add to global environment, run during install
        self.install += environ

        # Also define for global environment
        self.environ += environ
400856
def load_env(file):
    

    env = yaml.load(open(file))

    for org in env.get('organizations', []):
        if not org.get('applications'):
            org['applications'] = []

        if org.get('starter-kit'):
            kit_meta = get_starter_kit_meta(org.get('starter-kit'))
            for meta_app in get_applications_from_metadata(kit_meta):
                org['applications'].append(meta_app)

        if org.get('meta'):
            for meta_app in get_applications_from_metadata(org.get('meta')):
                org['applications'].append(meta_app)

        for app in org.get('applications', []):
            if app.get('file'):
                app['file'] = os.path.realpath(os.path.join(os.path.dirname(file), app['file']))
    return env
1371747
def loads(content):
    """"""
    lines = _group_lines(line for line in content.split('\n'))
    lines = [
        (i, _parse_envfile_line(line))
        for i, line in lines if line.strip()
    ]
    errors = []
    # Reject files with duplicate variables (no sane default).
    duplicates = _find_duplicates(((i, line[0]) for i, line in lines))
    for i, variable, j in duplicates:
        errors.append(''.join([
                'Line %d: duplicate environment variable "%s": ',
                'already appears on line %d.',
            ]) % (i + 1, variable, j + 1)
        )
    # Done!
    if errors:
        raise ValueError(errors)
    return {k: v for _, (k, v) in lines}
386032
function load() {
		Object.keys(envs).forEach(function(envName) {
			environments[envName] = envs[envName];
		});
	}
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
848541
def get_env(env_file='.env'):
    
    try:
        with open(env_file) as f:
            for line in f.readlines():
                try:
                    key, val = line.split('=', maxsplit=1)
                    os.environ.setdefault(key.strip(), val.strip())
                except ValueError:
                    pass
    except FileNotFoundError:
        pass
295485
def load_environment_vars(self, prefix=SANIC_PREFIX):
        
        for k, v in os.environ.items():
            if k.startswith(prefix):
                _, config_key = k.split(prefix, 1)
                try:
                    self[config_key] = int(v)
                except ValueError:
                    try:
                        self[config_key] = float(v)
                    except ValueError:
                        try:
                            self[config_key] = strtobool(v)
                        except ValueError:
                            self[config_key] = v
300891
def file_envs(self, load=None):
        '''
        
        '''
        if load is None:
            load = {}
        load.pop('cmd', None)
        return self.envs(**load)
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])
1329615
def get_environment(name):
    """"""
    if name == "_default":
        return env_from_template(name)
    filename = os.path.join("environments", name + ".json")
    try:
        with open(filename) as f:
            try:
                return json.loads(f.read())
            except ValueError as e:
                msg = 'LittleChef found the following error in'
                msg += ' "{0}":\n                {1}'.format(filename, str(e))
                abort(msg)
    except IOError:
        raise FileNotFoundError('File {0} not found'.format(filename))