Auto load all configs from app configs
14255
def auto_load_configs(self):
        """"""
        for app in apps.get_app_configs():
            for model in app.get_models():
                config = ModelConfig(model, getattr(app, model.__name__, None))
                self.configs[self.get_model_name(model)] = config
1132435
function(app) {
  app.loadConfigBaseApp(Constants.RESERVED.MASTER, Constants.FILEPATH.MASTER);
  app.master = app.get(Constants.RESERVED.MASTER);
}
141138
def load_config(cls, opts, path=None, profile=None):
        """"""
        if path and os.path.exists(path):
            if os.path.isdir(path):
                cls.config_searchpath.insert(0, path)
            else:
                cls.config_files.insert(0, path)

        config = cls.read_config()
        values = config.get("default", {})
        cls._load_values_into_opts(opts, values)

        if profile and profile != "default":
            values = config.get("profile:%s" % profile, {})
            cls._load_values_into_opts(opts, values)

        return values
486164
def config_extensions(app):
    "  "

    cache.init_app(app)
    db.init_app(app)
    main.init_app(app)
    collect.init_app(app)

    config_babel(app)
321473
def init_app(self, app):
        """"""
        if self.module:
            app.config.from_object(self.module)
167565
async function loadModulesConfig()
{
    if(!modulesLoaded)
    {
		for (let i = 0; i < modules.length; i++) {
			await applyBotDataSource(modules[i]);
        }
        
        modulesLoaded = true;
    }
}
91543
def load_dynamic_config(config_file=DEFAULT_DYNAMIC_CONFIG_FILE):
    """"""
    dynamic_configurations = {}

    # Insert config path so we can import it
    sys.path.insert(0, path.dirname(path.abspath(config_file)))
    try:
        config_module = __import__('config')

        dynamic_configurations = config_module.CONFIG
    except ImportError:
        # Provide a default if config not found
        LOG.error('ImportError: Unable to load dynamic config. Check config.py file imports!')

    return dynamic_configurations
100526
private function loadConfig()
    {
        // Look for .terra.yml
        $fs = new FileSystem();
        if ($fs->exists($this->getSourcePath().'/.terra.yml')) {
            try {
                // Process any string replacements.
                $environment_config_string = file_get_contents($this->getSourcePath().'/.terra.yml');
                $this->config = Yaml::parse(strtr($environment_config_string, array(
                  '{{alias}}' => $this->getDrushAlias(),
                  '{{uri}}' => $this->getUrl(),
                  '{{environment}}' => $this->environment->name,
                  '{{apps}}' => $this->app->name,
                )));
            }
            catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
                $this->config = null;
            }
        } else {
            $this->config = null;
        }
    }
777624
def load_config(app_name, *args, **kwargs):
    
    configure_logging()

    # compatible with Python 2 and 3.
    prefix = kwargs.get('prefix', 'etc')
    verbose = kwargs.get('verbose', False)
    location = kwargs.get('location', None)
    passphrase = kwargs.get('passphrase',
        os.getenv("%s_SETTINGS_CRYPT_KEY" % app_name.upper(),
            os.getenv("SETTINGS_CRYPT_KEY", None)))
    confnames = args

    if not location:
        location = os.getenv("%s_SETTINGS_LOCATION" % app_name.upper(), None)
    if not location:
        location = os.getenv("SETTINGS_LOCATION", None)
        if location:
            location = "%s/%s" % (location, app_name)

    config = {}
    for confname in confnames:
        content = None
        if location and location.startswith('s3://'):
            try:
                import boto
                _, bucket_name, prefix = urlparse(location)[:3]
                try:
                    conn = boto.connect_s3()
                    bucket = conn.get_bucket(bucket_name)
                    key_name = '%s/%s' % (prefix, confname)
                    key = bucket.get_key(key_name)
                    content = key.get_contents_as_string()
                    if verbose:
                        LOGGER.info("config loaded from 's3://%s/%s'",
                            bucket_name, key_name)
                except (boto.exception.NoAuthHandlerFound,
                        boto.exception.S3ResponseError) as _:
                    pass
            except ImportError:
                pass

        # We cannot find a deployutils S3 bucket. Let's look on the filesystem.
        if not content:
            confpath = locate_config(
                confname, app_name, location=location,
                prefix=prefix, verbose=verbose)
            if confpath:
                with open(confpath, 'rb') as conffile:
                    content = conffile.read()

        if content:
            if passphrase:
                content = crypt.decrypt(content, passphrase)
            if hasattr(content, 'decode'):
                content = content.decode('utf-8')
            for line in content.split('\n'):
                if not line.startswith('#'):
                    look = re.match(r'(\w+)\s*=\s*(.*)', line)
                    if look:
                        try:
                            # We used to parse the file line by line.
                            # Once Django 1.5 introduced ALLOWED_HOSTS
                            # (a tuple that definitely belongs to the site.conf
                            # set), we had no choice other than resort
                            # to eval(value, {}, {}).
                            # We are not resorting to import conf module yet
                            # but that might be necessary once we use
                            # dictionary configs for some of the apps...
                            # TODO: consider using something like ConfigObj
                            # for this:
                            # http://www.voidspace.org.uk/python/configobj.html
                            #pylint:disable=eval-used
                            config.update({look.group(1).upper():
                                eval(look.group(2), {}, {})})
                        except Exception:
                            raise

    return config
315249
def __load_configuration(self):
        
        handler_to_enable = filter(lambda h: h.keys is not None, handlers)
        for handler in handler_to_enable:
            if handler.name in self.kwargs:
                for k in handler.keys:
                    self.kwargs.update({k: True})

        self.config = self.configuration_class(self.app.config, **self.kwargs)
1293465
def load():
    
    config = ConfigParser.RawConfigParser(DEFAULTS)
    config.readfp(open(CONF_PATH))
    for section in config.sections():
        globals()[section] = {}
        for key, val in config.items(section):
            globals()[section][key] = val
1136615
def load_configuration(app_name):
    '''
    
    '''
    if sys.prefix == '/usr':
        conf_dir = '/etc'
        share_dir = '/usr/share'
    else:
        conf_dir = os.path.join(sys.prefix, 'etc')
        share_dir = os.path.join(sys.prefix, 'share')
    # Step 1: try to locate pynlp.yml
    yml_config = {}
    for fname in [
            '%s.yml'%(app_name,),
            os.path.expanduser('~/.%s.yml'%(app_name,)),
            os.path.join(conf_dir, '%s.yml'%(app_name,))]:
        if os.path.exists(fname):
            yml_config = yaml.load(open(fname))
            break
    try:
        data_dir = yml_config['paths']['data_dir']
    except KeyError:
        try:
            data_dir = os.environ[app_name.upper()]
        except KeyError:
            data_dir = os.path.join(share_dir, app_name)
    return AppContext(yml_config, data_dir)
865405
def config_load(ctx, param, value):
    """"""
    if ctx.obj is None:
        ctx.obj = {}

    ctx.obj['config_path'] = value
    ctx.obj['config'] = read_config(value)
    return value
792955
def init_config(self, app):
        
        config_apps = ['REST_', 'CORS_', ]
        for k in dir(config):
            if any([k.startswith(prefix) for prefix in config_apps]):
                app.config.setdefault(k, getattr(config, k))
138417
def setup_app(command, conf, vars):
    """"""
    # Don't reload the app if it was loaded under the testing environment
    if not pylons.test.pylonsapp:
        load_environment(conf.global_conf, conf.local_conf)
1120932
def _load_config(self):
        
        # load the global config
        with open(self.config_global_path, "r") as f_config:
            config = ordered_yaml_load(f_config)
        self.config_global = config

        # Load the local config
        if self.config_global_local_path:
            config = ordered_yaml_load(open(self.config_global_local_path, "r"))
            self.config_global_local = config

        self.config = merge_config(
            OrderedDict(
                [
                    ("global_config", self.config_global),
                    ("global_local", self.config_global_local),
                ]
            )
        )
459529
def init_config(self, app):
        
        _vars = ['BASE_TEMPLATE', 'COVER_TEMPLATE', 'SETTINGS_TEMPLATE']

        # Sets RequireJS config and SASS binary as well if not already set.
        for k in dir(config):
            if k.startswith('THEME_') or k in [
                    'REQUIREJS_CONFIG', 'SASS_BIN'] + _vars:
                app.config.setdefault(k, getattr(config, k))

        # Set THEME_<name>_TEMPLATE from <name>_TEMPLATE variables if not
        # already set.
        for varname in _vars:
            theme_varname = 'THEME_{}'.format(varname)
            if app.config[theme_varname] is None:
                app.config[theme_varname] = app.config[varname]

        app.config.setdefault(
            'ADMIN_BASE_TEMPLATE', config.ADMIN_BASE_TEMPLATE)