Exemplo n.º 1
0
 def _load_config(self, value):
     # Load default configuration
     config = Configuration()
     cfg_file = self.path / 'config.yml'
     if value is None and cfg_file.exists():
         # Load workflow-specific configuration from file
         value = confit.ConfigSource({}, unicode(cfg_file))
     if value is not None:
         # Load configuration from supplied ConfigSource or dictionary
         config = config.with_overlay(value)
     return config
Exemplo n.º 2
0
    def _load_config(self, value):
        """ Load configuartion from file in bag and optionally overlay it with
            new values.

        :param value:   Values to overlay over over loaded configuration
        :type value:    dict or :py:class:`confit.ConfigView`
        :returns:       Loaded (and overlaid) configuration
        :rtype:         :py:class:`confit.Configuration`
        """
        # Load default configuration
        config = Configuration()
        cfg_file = self.path / 'config.yml'
        if value is None and cfg_file.exists():
            # Load workflow-specific configuration from file
            value = confit.ConfigSource(confit.load_yaml(unicode(cfg_file)),
                                        unicode(cfg_file))
        if value is not None:
            # Load configuration from supplied ConfigSource or dictionary
            config = config.with_overlay(value)
        return config