def get_value()

in web-backend/configuration/configuration.py [0:0]


    def get_value(self, key: str, default: str = None) -> str:
        
        if key is None:
            raise Exception('The key parameter is required for get_value().')

        value = None

        allow_env_vars = False
        if "allow_environment_variables" in os.environ:
            allow_env_vars = bool(os.environ[
                    "allow_environment_variables"
                    ])

        if allow_env_vars is True:
            value = os.environ.get(key)

        if value is None:
            try:
                value = self.get_config_with_retry(name=key)
            except Exception as e:
                pass

        if value is not None:
            return value
        else:
            if default is not None:
                return default
            
            raise Exception(f'The configuration variable {key} not found.')