-
Notifications
You must be signed in to change notification settings - Fork 421
Feature flags: unable to get configuration for non feature flags related configurations #653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Work around:
Works great, that is what we do. |
yeah, but it's an extra conf to deploy and then use an extra conf store instead of one. It's an easy fix. |
I agree with Ran here - we can do better. We’re gonna tackle this in our
maintainers hackathon today (we’ll do an external one if we succeed in
cleaning up some bugs and enhancements).
I think we could have a property where you can have access to the full
configuration - we’ll experiment today ;-)
…On Fri, 1 Oct 2021 at 06:08, Ran Isenberg ***@***.***> wrote:
yeah, but it's an extra conf to deploy and then use an extra conf store
instead of one. It's an easy fix.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#653 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBHRABXYYNACK6NZBXLUEUX23ANCNFSM5CZVVSEA>
.
|
Pending final tests and merging shortly - this will be available in the next release (as early next week as I can) UX for accessing the raw configuration fetched by the Store from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore
app_config = AppConfigStore(
environment="dev",
application="product-catalogue",
name="configuration",
envelope = "feature_flags"
)
feature_flags = FeatureFlags(store=app_config)
config = app_config.get_raw_configuration |
This is now available as part of 1.21.0 - Thanks for flagging this Ran so we could do better ;) https://github.com/awslabs/aws-lambda-powertools-python/releases/tag/v1.21.0 |
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,
),
)
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?
The text was updated successfully, but these errors were encountered: