loganasherjones / yapconf

Yet Another Python Configuration
http://yapconf.readthedocs.io/en/stable/
MIT License
18 stars 4 forks source link

Environment loading error #74

Closed hazmat345 closed 6 years ago

hazmat345 commented 6 years ago

Config loading breaks after upgrading from 0.2.4 to 0.3.0.

This is the call that's breaking:

spec.load_config(cli_args, 'ENVIRONMENT', bootstrap=True)

And the output:

brew_view/__init__.py:41: in setup_brew_view
    config = bg_utils.load_application_config(spec, cli_args)
../bg-utils/bg_utils/__init__.py:132: in load_application_config
    temp_config = spec.load_config(*config_sources, bootstrap=True)
../../../.pyenv/versions/3.6.4/envs/brew-view/lib/python3.6/site-packages/yapconf/spec.py:325: in load_config
    overrides = self._generate_overrides(*args)
../../../.pyenv/versions/3.6.4/envs/brew-view/lib/python3.6/site-packages/yapconf/spec.py:482: in _generate_overrides
    overrides.append(source.generate_override(self._separator))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <yapconf.sources.EnvironmentConfigSource object at 0x7f22a0bc8940>, separator = '.'

    def generate_override(self, separator='.'):
        """Generate an override.

            Uses ``get_data`` which is expected to be implemented by each child
            class.

            Returns:
                A tuple of label, dict

            Raises:
                YapconfLoadError: If a known error occurs.

            """
        data = self.get_data()
        if not isinstance(data, dict):
            raise YapconfLoadError(
                'Invalid source (%s). The data was loaded successfully, but '
                'the result was not a dictionary. Got %s' %
>               (self.label, type(data))
            )
E           yapconf.exceptions.YapconfLoadError: Invalid source (ENVIRONMENT). The data was loaded successfully, but the result was not a dictionary. Got <class 'os._Environ'>
loganasherjones commented 6 years ago

Can confirm. Will release 0.3.1 tonight.

hazmat345 commented 6 years ago

Can confirm that 0.3.1 fixes this. Thanks!