Skip to content

Feature flags: unable to get configuration for non feature flags related configurations #653

Closed
@ran-isenberg

Description

@ran-isenberg

In the first draft of the feature, it was possible to use the AppConfigStore class to get a JSOM configuration that included non feature flsgs configuration.
However, when using an envelope parameter to contain the feature flags parts of the configuration, it is impossible to get the full schema back due to an 'if' in the code. I'm unable to use the AppConfigStore and FeatureFlags as a way to combine my regular configuration and feature flags configuration.
I had to extend AppConfigStore with my own store and add a new get_full_configuration function which disregards the envelope parameter.

at AppConfigStore.get_configuration:
try:
# parse result conf as JSON, keep in cache for self.max_age seconds
config = cast(
dict,
self._conf_store.get(
name=self.name,
transform=TRANSFORM_TYPE,
max_age=self.cache_seconds,
),
)

        if self.envelope:
            config = jmespath_utils.extract_data_from_envelope(
                data=config, envelope=self.envelope, jmespath_options=self.jmespath_options
            )

        return config

This will always return the feature flags conf and wont allow me to use the other conf.
my conf looks like this:
{
'log_level': 'DEBUG',
'features': {
'my_fake_feature': {
'default': True
}
}

and i init AppConfigStore with envelope="features"
I want to be able to use the feature flags and also get back the entire json file which contains log_level. I then use Pydantic to parse only the log_level out of the json (it "throws" aways the features part).

There are two options:
Add an optional boolean to the get_configuration function which will cause it to disregard the envelope param (have it set to False by deault) or add a new function for getting "full" configuration.
What do you think?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingp2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions