Creates a user configuration class to overwrite a default configuration
344492
public function doExecute(Console $console) {
        if (file_exists($this->targetFile)) {
            $console->out->writeLine('Already exists');
            return;
        }

        $creator = new Creator();
        $creator->createStub($this->baseClass, $this->targetFile);
        $console->out->writeLine('Created user configuration in ' . $this->targetFile);
    }
243625
function initUserConfig ( config ) {

    var parsedConfig = {};

    if ( !config ) {
        return;
    }

    config = config.split( ";" );

    $.each( config, function ( index, item ) {

        item = item.split( ":" );
        parsedConfig[ item[ 0 ] ] = item[ 1 ];

    } );

    setUserConfig( parsedConfig );

}
881270
public static function rewriteConfiguration()
	{
		// Get Current Configuration
		$config = Configuration::get();

		// Add Application Name to Configuration
		$config['name'] = Yii::$app->config->get(Enum::APP_NAME);

		// Add Caching
		$cacheClass = Yii::$app->config->get(Enum::CACHE_CLASS);
		if (!$cacheClass) {
			$cacheClass = FileCache::className();
		}
		$config['components']['cache'] = [
			'class' => $cacheClass
		];

		// Add Auth Clients
		$config['components']['authClientCollection']['class'] = 'yii\\authclient\\Collection';

		Configuration::set($config);
	}
1019182
def _create_config(self):
        """"""
        configinfo = {'creation_date': [ datetime.datetime.now().date().isoformat()],
                      'author': [self.site.site_config['default_author']],
                      'status': [u'draft'],
                      'lang': [u''],
                      'tags': [u''],
                      'title': [self._title],
                      'slug': [self._slug],
                      'theme': [u''],
                      'template': [u''],
                      'page_id': [uuid.uuid4().hex]
                      }  # when theme and template are empty, the generator uses the defaults. Thus, initially
                                          # they should be empty, to allow for global changes just by changing the site config files.
        return configinfo
934479
def from_user_config(cls):
        
        # Try in the current directory.
        path = os.path.join(os.getcwd(), cls.YAML_FILE)

        if os.path.exists(path):
            return cls.from_file(path)

        # Try in the configuration directory.
        path = os.path.join(cls.USER_CONFIG_DIR, cls.YAML_FILE)

        if os.path.exists(path):
            return cls.from_file(path)

        raise cls.Error("Cannot locate %s neither in current directory nor in %s" % (cls.YAML_FILE, path))
763986
def _create_overrides_from_config(config):
    """"""
    d = {}
    for s in config.sections():
        d[s] = {}
        for opt in config.options(s):
            d[s][opt] = config.get(s, opt)
    return d
1099866
def create(file_path):
    """"""
    if os.path.exists(file_path):
        raise IOError("There is already a configuration file at %s" %
                      file_path)
    with open(file_path, 'w') as f:
        config = configparser.ConfigParser()
        config.add_section('misc')
        config.set('misc', 'config-version', '1.0')
        default_nb_name = os.path.split(os.path.dirname(file_path))[1]
        config.set('misc', 'nb-name', default_nb_name)
        config.add_section('root')
        config.set('root', 'path', '.')
        config.add_section('models')
        config.set('models', 'module', 'models')
        config.add_section('tests')
        config.set('tests', 'module', 'tests')
        config.add_section('suites')
        config.set('suites', 'module', 'suites')
        config.write(f)
603118
def _create_default_config(self):
        ''''''
        # maybe I should read the default config from somewhere in the package?
        cfg = { 'site_title': '',
                'site_subtitle': '',
                'default_author': '',
                'site_url': '',
                'default_theme': 'blog1',
                'default_template': 'main.html.tpl',
                'fixed_frontpage': ''
              }


        file_name = os.path.join(self._dirs['s2'],'config.yml')
        f = open(file_name,'w')
        f.write(yaml.dump(cfg,default_flow_style=False))
        f.close()
        return cfg
1118729
def load_config(cls):
        
        config_file = os.path.expanduser(cls.home_config)
        global_conf = cls.load(config_file, 'global')
        cls.load(cls.local_config, 'local')
        # update global configuration if needed
        cls.update_config(config_file, global_conf)
784416
def _set_default_configs(user_settings, default):
    
    for key in default:
        if key not in user_settings:
            user_settings[key] = default[key]

    return user_settings
863829
def set_default(cls, name):
        """"""
        if name not in cls._depots:
            raise RuntimeError('%s depot has not been configured' % (name,))
        cls._default_depot = name
508364
def _setup_configuration(self):
        
        self.configuration = dict(
            schema_cls=self.schema_cls,
            allowed_actions=self.allowed_actions,
            filter_by_fields=self.filter_by_fields,
            order_by_fields=self.order_by_fields,
            aggregate_by_fields=self.aggregate_by_fields,
            default_offset=self.default_offset,
            default_limit=self.default_limit)

        authentication = self.authentication_cls(schema_cls=self.schema_cls)
        authorization = self.authorization_cls(schema_cls=self.schema_cls)
        request_params_validation = self.request_params_validation_cls(
            schema_cls=self.schema_cls,
            filter_by_fields=self.filter_by_fields,
            order_by_fields=self.order_by_fields,
            aggregate_by_fields=self.aggregate_by_fields
        )
        schema_validation = self.schema_validation_cls(
            schema_cls=self.schema_cls)
        data_cleaner = self.data_cleaner_cls(schema_cls=self.schema_cls)
        entity_actions = self.entity_actions_cls(
            schema_cls=self.schema_cls,
            default_limit=self.default_limit,
            default_offset=self.default_offset)
        post_action_hooks = self.post_action_hooks_cls(
            schema_cls=self.schema_cls)
        response_converter = self.response_converter_cls(
            schema_cls=self.schema_cls)
        serializer = self.serializer_cls(schema_cls=self.schema_cls)

        self.configuration.update(dict(
            authentication=authentication,
            authorization=authorization,
            request_params_validation=request_params_validation,
            schema_validation=schema_validation,
            data_cleaner=data_cleaner,
            entity_actions=entity_actions,
            post_action_hooks=post_action_hooks,
            response_converter=response_converter,
            serializer=serializer))
190944
function overrideConfig(config) {
    if (fs.existsSync(config.config)) {
        var content = fs.readFileSync(config.config, {
            encoding: "utf8"
        });
        var configFile = JSON.parse(content);
        for (var key in configFile) {
            if (configFile.hasOwnProperty(key)) {
                config[key] = configFile[key];
            }
        }
    }
    return config;
}
797801
def init_config(cls):
        
        try:
            # first load current conf and only overwrite needed params
            # we don't want to reset everything
            config_file = os.path.expanduser(cls.home_config)
            config = cls.load(config_file, 'global')
            cls._del('global', 'api.env')

            hidden_apikey = '%s...' % cls.get('api.key', '')[:6]
            apikey = click.prompt('Api key (xmlrpc)',
                                  default=hidden_apikey)
            if apikey == hidden_apikey:
                # if default value then use actual value not hidden one
                apikey = cls.get('api.key')
            env_choice = click.Choice(list(cls.apienvs.keys()))
            apienv = click.prompt('Environnment [production]/ote',
                                  default=cls.default_apienv,
                                  type=env_choice,
                                  show_default=False)
            sshkey = click.prompt('SSH keyfile',
                                  default='~/.ssh/id_rsa.pub')
            hidden_apikeyrest = '%s...' % cls.get('apirest.key', '')[:6]
            apikeyrest = click.prompt('Api key (REST)',
                                      default=hidden_apikeyrest)
            if apikeyrest == hidden_apikeyrest:
                # if default value then use actual value not hidden one
                apikeyrest = cls.get('apirest.key')

            config.update({
                'api': {'key': apikey,
                        'host': cls.apienvs[apienv]},
            })
            if apikeyrest:
                config.update({
                    'apirest': {'key': apikeyrest},
                })

            if sshkey is not None:
                sshkey_file = os.path.expanduser(sshkey)
                if os.path.exists(sshkey_file):
                    config['sshkey'] = [sshkey_file]

            directory = os.path.expanduser(os.path.dirname(config_file))
            if not os.path.exists(directory):
                mkpath(directory, 0o700)

            # save to disk
            cls.save(config_file, config)
            # load in memory
            cls.load(config_file, 'global')
        except (KeyboardInterrupt, click.exceptions.Abort):
            cls.echo('Aborted.')
            sys.exit(1)
643617
def load_user():
    """"""
    config_path = get_user_config_path()
    config = {}

    # TODO: This may be overkill and too slow just for reading a config file
    with open(config_path) as f:
        code = compile(f.read(), config_path, 'exec')
    exec(code, config)

    keys = list(six.iterkeys(config))
    for k in keys:
        if k.startswith('_'):
            del config[k]

    return config
89882
def configure(ctx, helper, edit):
    '''
    
    '''

    ctx.obj.config = ConfigFile(ctx.obj.config_file)

    if edit:
        ctx.obj.config.edit_config_file()
        return

    if os.path.isfile(ctx.obj.config.config_file):
        ctx.obj.config.read_config()

    if ctx.obj.profile is None:
        ctx.obj.profile = ctx.obj.config.default_profile

    args, kwargs = _parse_args_and_kwargs(ctx.args)
    assert len(args) == 0, 'Unrecognized arguments: "{}"'.format(args)

    if ctx.obj.profile not in ctx.obj.config.config['profiles']:
        ctx.obj.config.config['profiles'][ctx.obj.profile] = {
            'api': {'user_config': {}}, 'manager': {}, 'authorities': {}}

    profile_config = ctx.obj.config.config['profiles'][ctx.obj.profile]
    profile_config['api']['user_config'].update(kwargs)

    ctx.obj.config.write_config(ctx.obj.config_file)

    _generate_api(ctx)

    if ctx.obj.api.manager is not None:
        check_requirements(
            to_populate=profile_config['api']['user_config'],
            prompts=ctx.obj.api.manager.required_user_config,
            helper=helper)

    ctx.obj.config.write_config(ctx.obj.config_file)
744359
def _configure(configuration_details):
    """"""
    path = Path(configuration_details.path).expanduser()
    with path.open('a') as shell_config:
        shell_config.write(u'\n')
        shell_config.write(configuration_details.content)
        shell_config.write(u'\n')