Get an instance of Api Environment services facade.
429543
def create_api_environment(self):
        """"""
        return ApiEnvironment(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
128967
def get(self):
        

        self._cast = type([])
        source_value = os.getenv(self.env_name)

        # set the environment if it is not set
        if source_value is None:
            os.environ[self.env_name] = json.dumps(self.default)
            return self.default

        try:
            val = json.loads(source_value)
        except JSONDecodeError as e:
            click.secho(str(e), err=True, color='red')
            sys.exit(1)
        except ValueError as e:
            click.secho(e.message, err=True, color='red')
            sys.exit(1)

        if self.validator:
            val = self.validator(val)

        return val
1000299
def create_api_context(self, cls):
        """"""
        return self.api_context_schema().load({
            "name": cls.name,
            "cls": cls,
            "inst": [],
            "conf": self.conf.get_api_service(cls.name),
            "calls": self.conf.get_api_calls(),
            "shared": {},  # Used per-API to monitor state
            "log_level": self.conf.get_log_level(),
            "callback": self.receive
            })
875827
async def get_instance(self, resource_id) -> ApiResource:
        """"""
        raw = await self.get_resource(resource_id)
        return self._resource_factory(self._get_to_actual_data(raw))
655166
def get_account(config, environment, stage=None):
    """"""
    if environment is None and stage:
        environment = get_environment(config, stage)
    account = None
    for env in config.get('environments', []):
        if env.get('name') == environment:
            account = env.get('account')
            role = env.get('role')
            username = os.environ.get(env.get('rs_username_var')) \
                if env.get('rs_username_var') else None
            apikey = os.environ.get(env.get('rs_apikey_var')) \
                if env.get('rs_apikey_var') else None
    if not account:
        sys.exit(ACCT_NOT_FOUND_ERROR.format(environment))
    return account, role, username, apikey
1060695
def get_instance(self, payload):
        
        return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], )
587023
def get_environments():
    """"""
    envs = []
    for root, subfolders, files in os.walk('environments'):
        for filename in files:
            if filename.endswith(".json"):
                path = os.path.join(
                    root[len('environments'):], filename[:-len('.json')])
                envs.append(get_environment(path))
    return sorted(envs, key=lambda x: x['name'])
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))
909132
def environment(**options):
    
    env = Environment(**options)
    env.globals.update({
        'static': staticfiles_storage.url,
        'url': reverse,
    })
    env.globals.update(context_processors.environment())
    return env
1162134
def get_environ(self):
        """"""
        req = self.req
        env = {
            # set a non-standard environ entry so the WSGI app can know what
            # the *real* server protocol is (and what features to support).
            # See http://www.faqs.org/rfcs/rfc2145.html.
            'ACTUAL_SERVER_PROTOCOL': req.server.protocol,
            'PATH_INFO': req.path,
            'QUERY_STRING': req.qs,
            'REMOTE_ADDR': req.conn.remote_addr or '',
            'REMOTE_PORT': str(req.conn.remote_port or ''),
            'REQUEST_METHOD': req.method,
            'REQUEST_URI': req.uri,
            'SCRIPT_NAME': '',
            'SERVER_NAME': req.server.server_name,
            # Bah. "SERVER_PROTOCOL" is actually the REQUEST protocol.
            'SERVER_PROTOCOL': req.request_protocol,
            'SERVER_SOFTWARE': req.server.software,
            'wsgi.errors': sys.stderr,
            'wsgi.input': req.rfile,
            'wsgi.multiprocess': False,
            'wsgi.multithread': True,
            'wsgi.run_once': False,
            'wsgi.url_scheme': req.scheme,
            'wsgi.version': (1, 0),
            }
        
        if isinstance(req.server.bind_addr, basestring):
            # AF_UNIX. This isn't really allowed by WSGI, which doesn't
            # address unix domain sockets. But it's better than nothing.
            env["SERVER_PORT"] = ""
        else:
            env["SERVER_PORT"] = str(req.server.bind_addr[1])
        
        # Request headers
        for k, v in req.inheaders.iteritems():
            env["HTTP_" + k.upper().replace("-", "_")] = v
        
        # CONTENT_TYPE/CONTENT_LENGTH
        ct = env.pop("HTTP_CONTENT_TYPE", None)
        if ct is not None:
            env["CONTENT_TYPE"] = ct
        cl = env.pop("HTTP_CONTENT_LENGTH", None)
        if cl is not None:
            env["CONTENT_LENGTH"] = cl
        
        if req.conn.ssl_env:
            env.update(req.conn.ssl_env)
        
        return env
1371334
def get_environment(id=None, name=None):
    
    data = get_environment_raw(id, name)
    if data:
        return utils.format_json(data)
614521
def get_from_env():
    
    type_env = os.getenv(OC_RESOURCE_TYPE)
    if type_env is None:
        return None
    type_env = type_env.strip()

    labels_env = os.getenv(OC_RESOURCE_LABELS)
    if labels_env is None:
        return Resource(type_env)

    labels = parse_labels(labels_env)

    return Resource(type_env, labels)
1056876
def get_instance(self, payload):
        
        return BuildInstance(self._version, payload, service_sid=self._solution['service_sid'], )
356911
def create_ambiente(self):
        """"""
        return Ambiente(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
1179073
public static ApplicationEnvironment get() {
        return INSTANCE.updateAndGet((env) -> {
            if (env != null) {
                return env;
            }

            try (AutoCloseable handle = Performance.time("Load application environment")) {
                return new ApplicationEnvironment();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
1160415
private function getEnvironment()
  {
    $env = new \Dotenv\Dotenv($this->basePath);
    $env->load();
    $this->env['env'] = getenv('APP_ENV');
    $this->env['debug'] = getenv('APP_DEBUG');
    $this->env['appSecret'] = getenv('APP_KEY');
  }
1061989
def __parse_vcap_services_env_var(self, serviceInstanceName=None):
        
        vcapServices = os.environ.get(self.__VCAP_SERVICES_ENV_VAR)

        if not vcapServices:
            return (None, None, None, None, None)

        parsedVcapServices = json.loads(vcapServices)

        gpServicesInstances = []
        for serviceName in parsedVcapServices:
            if self.__gpServiceNameRegex.match(serviceName):
                serviceInstances = parsedVcapServices.get(serviceName)
                for serviceInstance in serviceInstances:
                    gpServicesInstances.append(serviceInstance)

        if not gpServicesInstances:
            return (None, None, None, None, None)

        targetGPServiceInstance = None
        # use first service if no name is provided
        if not serviceInstanceName:
            targetGPServiceInstance = gpServicesInstances[0]
        else:
            # search for service name
            for gpServiceInstance in gpServicesInstances:
                if gpServiceInstance.get(self.__NAME_KEY)== serviceInstanceName:
                    targetGPServiceInstance = gpServiceInstance
                    break

        # service was not found
        if not targetGPServiceInstance:
            return  (None, None, None, None, None)

        credentials = targetGPServiceInstance.get(self.__CREDENTIALS_KEY)

        if not credentials:
            return (None, None, None, None, None)

        url = credentials.get(self.__URL_KEY)
        instanceId = credentials.get(self.__INSTANCE_ID_KEY)
        userId = credentials.get(self.__USER_ID_KEY)
        password = credentials.get(self.__PASSWORD_KEY)
        apiKey = credentials.get(self.__IAM_API_KEY_KEY)

        return (url, instanceId, userId, password, apiKey)