Sets the config depending on the environment type
544355
def setup_environment(config: Dict[str, Any], environment_type: Environment) -> None:
    """"""
    # interpret the provided string argument
    if environment_type == Environment.PRODUCTION:
        # Safe configuration: restrictions for mainnet apply and matrix rooms have to be private
        config['transport']['matrix']['private_rooms'] = True

    config['environment_type'] = environment_type

    print(f'Raiden is running in {environment_type.value.lower()} mode')
162770
def set_env_from_args(args):
    ''' 
    '''
    args = vars(args)

    if args.get('apiserver_host') is not None:
        config['DX_APISERVER_HOST'] = args['apiserver_host']
    if args.get('apiserver_port') is not None:
        config['DX_APISERVER_PORT'] = args['apiserver_port']
    if args.get('apiserver_protocol') is not None:
        config['DX_APISERVER_PROTOCOL'] = args['apiserver_protocol']
    if args.get('project_context_id') is not None:
        config['DX_PROJECT_CONTEXT_ID'] = args['project_context_id']
    if args.get('workspace_id') is not None:
        config['DX_WORKSPACE_ID'] = args['workspace_id']
    if args.get('cli_wd') is not None:
        config['DX_CLI_WD'] = args['cli_wd']
    if args.get('security_context') is not None:
        config['DX_SECURITY_CONTEXT'] = args['security_context']
    if args.get('auth_token') is not None:
        config['DX_SECURITY_CONTEXT'] = json.dumps({"auth_token": args['auth_token'],
                                                    "auth_token_type": "Bearer"})
935154
def make_config(self, instance_relative: bool = False) -> Config:
        """"""
        config = self.config_class(
            self.instance_path if instance_relative else self.root_path,
            DEFAULT_CONFIG,
        )
        config['ENV'] = get_env()
        config['DEBUG'] = get_debug_flag()
        return config
1147483
def override(settings, yaml=None, env=None):
    
    if yaml is not None:
        if hasattr(yaml, 'read'):
            settings.update(load_yaml(yaml.read()))
        else:
            if os.path.exists(yaml):
                with open(yaml) as f:
                    settings.update(load_yaml(f.read()))

    if env is not None:
        for k, v in os.environ.items():
            if k.startswith(env):
                settings[k[len(env):]] = load_yaml(v)
1161249
def set_env_or_defaults(self):
        
        option = namedtuple('Option', ['section', 'name', 'env_var',
                                       'default_value'])

        options = [option('auth', 'user', 'NAPPS_USER', None),
                   option('auth', 'token', 'NAPPS_TOKEN', None),
                   option('napps', 'api', 'NAPPS_API_URI',
                          'https://napps.kytos.io/api/'),
                   option('napps', 'repo', 'NAPPS_REPO_URI',
                          'https://napps.kytos.io/repo'),
                   option('kytos', 'api', 'KYTOS_API',
                          'http://localhost:8181/')]

        for option in options:
            if not self.config.has_option(option.section, option.name):
                env_value = os.environ.get(option.env_var,
                                           option.default_value)
                if env_value:
                    self.config.set(option.section, option.name, env_value)

        self.config.set('global', 'debug', str(self.debug))
557197
def set_env(self, key, value):
        
        os.environ[make_env_key(self.appname, key)] = str(value)  # must coerce to string
        self._registered_env_keys.add(key)
        self._clear_memoization()
878108
def environment_variable(key, value):
    

    if key not in os.environ:
        previous = None
    else:
        previous = os.environ[key]

    os.environ[key] = value

    yield

    if previous is None:
        del os.environ[key]
    else:
        os.environ[key] = previous
471696
private function setDefaultConfiguration(): void
    {
        $this->parameterBag->set('app.devmode', false);
        $this->parameterBag->set('container.dumper.inline_class_loader', true);

        $this->config->addPass($this->parameterBag);
    }
1351163
function setConfig (options) {
  Object.keys(options).forEach((option) => {
    if (config[option] !== undefined) {
      config[option] = options[option]
    }
  })
}
1010115
private function setEnvironmentOption()
    {
        if (!array_key_exists('env', $this->options)) {
            $this->options = array_merge(
                $this->options,
                ['env' => App::environment()]
            );
        }
    }
1338072
def configure(self):
        # type: () -> None
        
        for i in vars(self):
            if i.startswith("_"):
                continue
            val = self.__get(i, return_type=type(getattr(self, i)))
            if val is not None:
                setattr(self, i, val)
1111466
private function set_up_environment() {
		if ( $this->it_has( 'environment' ) ) {
			$this->environment = $this->options['environment'];
		} else {
			$this->environment = defined( 'WP_DEBUG' ) && WP_DEBUG
				? 'development'
				: 'production';
		}
	}
948129
protected void configureEnv() {
        //TODO a sensor with the custom-environment variables?
        Map<String, String> envs=getEntity().getConfig(OpenShiftWebApp.ENV);
        if((envs!=null)&&(envs.size()!=0)){
            deployedApp.addEnvironmentVariables(envs);
            deployedApp.restart();
        }
    }
423771
def set_env_variables(stack, grid, platform = grid)
      ENV['STACK'] = stack
      ENV['GRID'] = grid
      ENV['PLATFORM'] = platform
    end
1104486
public function configure()
    {
        // environment
        $this->setEnv($this->getEnvFromEnvironmentVariables());

        // application root dir.
        $this->config('directory.root', dirname(dirname(__DIR__)));
        
        // application dir.
        $this->addAppPathUsePsr4(__DIR__, __NAMESPACE__, 'Samurai\\', self::PRIORITY_LOW);

        // set directory names.
        $this->config('directory.config.samurai', 'Config/Samurai');
        $this->config('directory.config.routing', 'Config/App');
        $this->config('directory.config.database', 'Config/Database');
        $this->config('directory.config.renderer', 'Config/Renderer');
        $this->config('directory.controller', 'Controller');
        $this->config('directory.model', 'Model');
        $this->config('directory.filter', 'Filter');
        $this->config('directory.layout', 'View/Layout');
        $this->config('directory.template', 'View');
        $this->config('directory.database.data', 'Database');
        $this->config('directory.database.migration', 'Database/Migration');
        $this->config('directory.database.seed', 'Database/Seed');
        $this->config('directory.database.schema', 'Database/Schema');
        $this->config('directory.locale', 'Locale');
        $this->config('directory.task', 'Task');
        $this->config('directory.spec', 'Spec');
        $this->config('directory.skeleton', 'Skeleton');
        $this->config('directory.log', 'Log');
        $this->config('directory.temp', 'Temp');

        // controllers
        $this->config('controller.namespaces', ['Samurai\Samurai']);
        
        // main dicon
        $this->config('container.dicon.', 'Config/Samurai/samurai.dicon');

        // set encodings.
        $this->config('encoding.input', 'UTF-8');
        $this->config('encoding.output', 'UTF-8');
        $this->config('encoding.internal', 'UTF-8');
        $this->config('encoding.text.html', 'UTF-8');

        // set caches.
        $this->config('cache.yaml.enable', true);
        $this->config('cache.yaml.expire', 60 * 60 * 24);    // 1 day
        
        // timezone.
        $this->config('locale', 'ja');
        $this->setTimezone('Asia/Tokyo');
        
        // autoload by samurai
        $loader = new Loader($this);
        $loader->register();
        $this->loader = $loader;
    }
202821
def configure(self, options, conf):
        
        super(EverestNosePlugin, self).configure(options, conf)
        opt_val = getattr(options, self.__dest_opt_name, None)
        if opt_val:
            self.enabled = True
            EverestIni.ini_file_path = opt_val
330604
def set_environ(env_name, value):
    """"""
    value_changed = value is not None
    if value_changed:
        old_value = os.environ.get(env_name)
        os.environ[env_name] = value
    try:
        yield
    finally:
        if value_changed:
            if old_value is None:
                del os.environ[env_name]
            else:
                os.environ[env_name] = old_value