Apply configuration file's plugin settings
765897
def apply_plugin_settings(self, options):
        """"""
        color_scheme_n = 'color_scheme_name'
        color_scheme_o = self.get_color_scheme()
        font_n = 'plugin_font'
        font_o = self.get_plugin_font()
        wrap_n = 'wrap'
        wrap_o = self.get_option(wrap_n)
        self.wrap_action.setChecked(wrap_o)
        linenb_n = 'line_numbers'
        linenb_o = self.get_option(linenb_n)
        for editor in self.editors:
            if font_n in options:
                scs = color_scheme_o if color_scheme_n in options else None
                editor.set_font(font_o, scs)
            elif color_scheme_n in options:
                editor.set_color_scheme(color_scheme_o)
            if wrap_n in options:
                editor.toggle_wrap_mode(wrap_o)
            if linenb_n in options:
                editor.toggle_line_numbers(linenumbers=linenb_o, markers=False)
605443
public function registerPlugins()
    {
        $jsonFile = Environment::getJsonConfigFilename();
        if (!$jsonFile) {
            return;
        }

        $config = new Config;
        $var    = $config->validate($jsonFile);

        foreach ($var['plugins'] as $plugin) {
            if (class_exists($plugin['class'])) {
                if (isset($plugin['options'])) {
                    $options = $plugin['options'];
                    if (is_string($options)) {
                        if (class_exists($options)) {
                            $options = new $options;
                        } else {
                            $options = null;
                        }
                    }
                } else {
                    $options = null;
                }
                $plugin = new $plugin['class']($options);

                if ($plugin instanceof PluginInterface) {
                    $this->addPlugin($plugin);
                }
            }
        }
    }
140552
public static function applyConfigValues()
    {
        $settings = self::instance();
        Config::set('app.locale', $settings->locale);
        Config::set('app.fallback_locale', $settings->fallback_locale);
    }
1141981
function formatConfig (config) {
  _.defaults(config, {debug: false, plugins: []})

  config.debugOptions = config.debugOptions || {}
  config.connectedTeams = new Set()

  if (!Array.isArray(config.plugins)) {
    config.plugins = [config.plugins]
  }

  config.scopes = _.chain(config.plugins)
    .map('scopes')
    .flatten()
    .concat(_.isArray(config.scopes) ? config.scopes : [])
    .uniq()
    .remove(_.isString.bind(_))
    .value()

  config.isSlackApp = !config.slackToken

  if (!config.slackToken && !(config.clientId && config.clientSecret && config.port)) {
    logger.error(`Missing configuration. Config must include either slackToken AND/OR clientId, clientSecret, and port`)
    process.exit(1)
  }
}
1307187
function configure() {
      var pkg = this.square.package
        , configuration = pkg.configuration
        , type = this.type || Plugin.modifier
        , self = this
        , load = [];

      // Check for the distribution and if it should accept the given extension,
      // extend self with the context of the plugin.
      if (!~type.indexOf('once') && (!this.distributable() || !this.accepted())) {
        this.logger.debug(
            'disregarding this plugin for extension: '+ this.extension
          +', distribution: '+ this.distribution
        );
        return this.emit('disregard');
      }

      // Check if there are any configuration options in the package.
      if (_.isObject(pkg.plugins) && this.id in pkg.plugins) {
        this.merge(this, pkg.plugins[this.id]);
      }

      // Merge in the plugin configuration.
      if (
           configuration
        && _.isObject(configuration.plugins)
        && this.id in configuration.plugins
      ) {
        this.merge(this, configuration.plugins[this.id]);
      }

      // Check if the bundle it self also had specific configurations for this
      // plugin.
      if (this.id in this && _.isObject(this[this.id])) {
        this.merge(this, this[this.id]);
      }

      // Ensure that our requires is an array, before we continue
      if (!Array.isArray(this.requires)) this.requires = [this.requires];

      // Check if we need to lazy load any dependencies
      if (this.requires && this.requires.length) {
        load = this.requires.map(function (file) {
          if (typeof file !== 'object') return file;
          if (!('extension' in file)) return file.name || file;
          if (file.extension === self.extension) return file.name || file;

          return undefined;
        }).filter(Boolean); // Only get existing files

        // Only fetch shizzle when we actually have shizzle to fetch here
        if (load.length) return canihaz.apply(canihaz, load.concat(function canihaz(err) {
          if (err) return self.emit('error', err);

          // Add all the libraries to the context, the `canihaz#all` returns an
          // error first, and then all libraries it installed or required in the
          // order as given to it, which is in our case the `this.requires` order.
          Array.prototype.slice.call(arguments, 1).forEach(function (lib, index) {
            self[load[index]] = lib;
          });

          // We are now fully initialized.
          if (self.initialize) self.initialize();
        }));
      }

      // We are now fully initialized.
      if (self.initialize) self.initialize();
    }
481827
public function applyConfigOverrides()
    {
        // init
        $config_items = [];

        foreach ($this->settings_default as $key => $value) {
            if (ee()->config->item($key)) {
                $config_items[$key] = ee()->config->item($key);
            }
        }

        if (is_array($this->settings)) {
            $this->settings = array_merge($this->settings, $config_items);
        }
    }
118871
def _setup_fun_config(self, fun_conf):
        '''
        
        '''
        conf = copy.deepcopy(self.config)
        conf['file_client'] = 'local'
        conf['fun'] = ''
        conf['arg'] = []
        conf['kwarg'] = {}
        conf['cache_jobs'] = False
        conf['print_metadata'] = False
        conf.update(fun_conf)
        conf['fun'] = conf['fun'].split(':')[-1]  # Discard typing prefix

        return conf
1153578
function Plugin(configPath, options) {

  if (arguments.length == 1 && typeof configPath === 'object') {
    options = configPath;
    configPath = options.configPath;
  } else if (arguments.length == 2 && typeof options === 'boolean') {
    options = { verbose: options }; // for backward compatibility
  }

  options = options || {};
  configPath = configPath || null;

  var verbose = options.verbose || false;
  //var lint = options.lint || false; // TODO: Report about found issues in style sheets

  // Create a stream through which each file will pass
  var stream = through.obj(function(file, enc, cb) {

    if (file.isNull()) {
      // Do nothing
    } else if (file.isStream()) {
      this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
      return cb();
    } else if (file.isBuffer() && SUPPORTED_EXTENSIONS.indexOf(path.extname(file.path)) !== -1) {

      if (verbose) {
        gutil.log(PLUGIN_NAME, 'Processing ' + gutil.colors.magenta(file.path));
      }

      if (configPath && !fs.existsSync(configPath)) {
        this.emit('error', new PluginError(PLUGIN_NAME, 'Configuration file not found: ' + gutil.colors.magenta(configPath)));
        return cb();
      }

      configPath = Comb.getCustomConfigPath(configPath || path.join(path.dirname(file.path), '.csscomb.json'));
      var config = Comb.getCustomConfig(configPath);

      if (verbose) {
        gutil.log(PLUGIN_NAME, 'Using configuration file ' + gutil.colors.magenta(configPath));
      }

      var comb = new Comb(config || 'csscomb');
      var syntax = options.syntax || file.path.split('.').pop();

      try {
        var output = comb.processString(
          file.contents.toString('utf8'), {
            syntax: syntax,
            filename: file.path
          });
        file.contents = new Buffer(output);
      } catch (err) {
        this.emit('error', new PluginError(PLUGIN_NAME, file.path + '\n' + err));
      }
    }

    // make sure the file goes through the next gulp plugin
    this.push(file);
    // tell the stream engine that we are done with this file
    return cb();
  });

  // Return the file stream
  return stream;
}
1006375
private void extractConfigSettings(Artifact artifact) throws MojoExecutionException {// NOSONAR
        try (JarFile configSettings = new JarFile(artifact.getFile())) {
            Enumeration<JarEntry> entries = configSettings.entries();
            while (entries.hasMoreElements()) {
                JarEntry jarFileEntry = entries.nextElement();
                // Only interested in files in the /bin directory that are not properties files
                if (!jarFileEntry.isDirectory() && jarFileEntry.getName().startsWith("bin")
                        && !jarFileEntry.getName().endsWith(".properties")) {
                    File fileToCreate = new File(jmeterDirectory, jarFileEntry.getName());
                    copyInputStreamToFile(configSettings.getInputStream(jarFileEntry), fileToCreate);
                }
            }
        } catch (IOException e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }
184172
function(config) {

        var defaults = {plugins: []};
        config = typeof config == 'object' && config || {};

        if (config.plugins && !Array.isArray(config.plugins)) {
            return { error: 'Error: Invalid plugins list. Provided \'plugins\' in config should be an array.' };
        }

        if (config.full) {
            defaults = config;

            if (Array.isArray(defaults.plugins)) {
                defaults.plugins = preparePluginsArray(defaults.plugins);
            }
        } else {
            defaults = {
              plugins: preparePluginsArray(defaults.plugins)
            }
            defaults = extendConfig(defaults, config);
        }

        if ('floatPrecision' in config && Array.isArray(defaults.plugins)) {
            defaults.plugins.forEach(function(plugin) {
                if (plugin.params && ('floatPrecision' in plugin.params)) {
                    // Don't touch default plugin params
                    plugin.params = EXTEND({}, plugin.params, { floatPrecision: config.floatPrecision });
                }
            });
        }

        if (Array.isArray(defaults.plugins)) {
            defaults.plugins = optimizePluginsArray(defaults.plugins);
        }

        return defaults;

    }
1011668
private void extendConfig(Configuration config, MavenShellCallback callback) {
    List<Context> contexts = config.getContexts();
    if (contexts == null) return;

    // fix java file encoding
    for (Context context : contexts) {
      context.addProperty(PropertyRegistry.CONTEXT_JAVA_FILE_ENCODING, "UTF-8");
    }

    if (!disableNameConversion) {
      PluginConfiguration pluginConfiguration = new PluginConfiguration();
      pluginConfiguration.setConfigurationType(ColumnNameConversionPlugin.class.getTypeName());
      pluginConfiguration.addProperty(ColumnNameConversionPlugin.COLUMN_PATTERN_NAME, columnPattern);
      addToContext(contexts, pluginConfiguration);
      if (verbose) getLog().info("enable name conversion service");
    }

    if (!disableExtendMethods) {
      PluginConfiguration pluginConfiguration = new PluginConfiguration();
      pluginConfiguration.setConfigurationType(BatchInsertPlugin.class.getTypeName());
      addToContext(contexts, pluginConfiguration);
      if (verbose) getLog().info("enable batch insert service");

      pluginConfiguration = new PluginConfiguration();
      pluginConfiguration.setConfigurationType(BatchUpdatePlugin.class.getTypeName());
      addToContext(contexts, pluginConfiguration);
      if (verbose) getLog().info("enable batch update service");

      for(Context context : contexts){
        chooseUpsertPlugin(context);
      }
    }

    if (!disableGeom) {
      for (Context context : contexts) {
        chooseGeomPlugin(context);
      }
    }

    if (!disablePagination) {
      for (Context context : contexts) {
        choosePaginationPlugin(context);
      }
    }

    if (overwrite) {
      PluginConfiguration pluginConfiguration = new PluginConfiguration();
      pluginConfiguration.setConfigurationType(MapperOverwriteEnablePlugin.class.getTypeName());
      addToContext(contexts, pluginConfiguration);
      if (verbose) getLog().info("enable mapper overwrite service");
    }

    if (enableQueryDslSupport) {
      PluginConfiguration pluginConfiguration = new PluginConfiguration();
      pluginConfiguration.setConfigurationType(QueryDslPlugin.class.getTypeName());
      addToContext(contexts, pluginConfiguration);
      if (verbose) getLog().info("enable querydsl support service");
    }

    if (!disableMergeSupport) {
      callback.setMergeSupported(true);
      PluginConfiguration pluginConfiguration = new PluginConfiguration();
      pluginConfiguration.setConfigurationType(XMLMergePlugin.class.getTypeName());
      pluginConfiguration.addProperty(XMLMergePlugin.ROOTDIR_NAME, outputDirectory.getAbsolutePath());
      addToContext(contexts, pluginConfiguration);
      if (verbose) getLog().info("enable content merge service");
    }

    // leave the cg for the last
    extendCG(config, contexts);

  }
777825
function extendConfig(defaults, config) {

        var key;

        // plugins
        if (config.plugins) {

            config.plugins.forEach(function(item) {

                // {}
                if (typeof item === 'object') {

                    key = Object.keys(item)[0];

                    // custom
                    if (typeof item[key] === 'object' && item[key].fn && typeof item[key].fn === 'function') {
                        defaults.plugins.push(setupCustomPlugin(key, item[key]));

                    } else {
                        defaults.plugins.forEach(function(plugin) {

                            if (plugin.name === key) {
                                // name: {}
                                if (typeof item[key] === 'object') {
                                    plugin.params = EXTEND({}, plugin.params || {}, item[key]);
                                    plugin.active = true;

                                // name: false
                                } else if (item[key] === false) {
                                   plugin.active = false;

                                // name: true
                                } else if (item[key] === true) {
                                   plugin.active = true;
                                }
                            }
                        });
                    }

                }

            });

        }

        defaults.multipass = config.multipass;

        // svg2js
        if (config.svg2js) {
            defaults.svg2js = config.svg2js;
        }

        // js2svg
        if (config.js2svg) {
            defaults.js2svg = config.js2svg;
        }

        return defaults;

    }
833839
def _setup_config_from_kwargs(kwargs):
        """"""
        cmd_list = ['--json', '--force']

        if 'file' in kwargs:
            cmd_list.extend(['--file', kwargs['file']])

        if 'system' in kwargs:
            cmd_list.append('--system')

        return cmd_list
1061192
def config():
    ''''''
    if hasattr(current_app, 'settings_file'):
        log.info('Loaded configuration from %s', current_app.settings_file)

    log.info(white('Current configuration'))
    for key in sorted(current_app.config):
        if key.startswith('__') or not key.isupper():
            continue
        echo('{0}: {1}'.format(white(key), current_app.config[key]))
1307973
function envPlugin(dynamicConfig, options) {
    var self = this;
    var separator;
    var whitelist;

    if (options && typeof options === "object") {
        separator = options.separator;
        whitelist = options.whitelist;
    }

    this(dynamicConfig).after("loadConfigFile", function (result) {
        self.override.result = merge(result, process.env, separator, whitelist);
    });
}
382225
public function patchPluginSettings()
    {
        $path_array = explode('/', $this->request->getUrl());
        $settingId = $path_array[3];

        $body = $this->request->getBody();
        $value = $body['value'];
        $options = $this->dataStore->set($settingId, $this->api->createPluginSettingObject($settingId, $value, true, true));

        if (!isset($options)) {
            return $this->api->createAPIError('Unable to update plugin settings');
        }

        if ($settingId === Plugin::SETTING_DEFAULT_SETTINGS) {
            try {
                $this->applyDefaultSettings();
            } catch (\Exception $e) {
                if ($e instanceof Exception\CloudFlareException) {
                    return $this->api->createAPIError($e->getMessage());
                } else {
                    throw $e;
                }
            }
        }

        $response = $this->api->createAPISuccessResponse($this->dataStore->get($settingId));

        return $response;
    }
74449
def setup_config(command, filename, section, vars):
    """"""
    conf = appconfig('config:' + filename)
    load_environment(conf.global_conf, conf.local_conf)