Skip to content

Commit 39c8dd6

Browse files
committed
docs: rearrange advanced sections based on popularity
1 parent 801c6b9 commit 39c8dd6

File tree

1 file changed

+43
-37
lines changed

1 file changed

+43
-37
lines changed

docs/utilities/feature_flags.md

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,49 @@ You can use `get_enabled_features` method for scenarios where you need a list of
379379

380380
## Advanced
381381

382+
### Adjusting in-memory cache
383+
384+
By default, we cache configuration retrieved from the Store for 5 seconds for performance and reliability reasons.
385+
386+
You can override `max_age` parameter when instantiating the store.
387+
388+
```python hl_lines="7"
389+
from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore
390+
391+
app_config = AppConfigStore(
392+
environment="dev",
393+
application="product-catalogue",
394+
name="features",
395+
max_age=300
396+
)
397+
```
398+
399+
### Getting fetched configuration
400+
401+
???+ info "When is this useful?"
402+
You might have application configuration in addition to feature flags in your store.
403+
404+
This means you don't need to make another call only to fetch app configuration.
405+
406+
You can access the configuration fetched from the store via `get_raw_configuration` property within the store instance.
407+
408+
=== "app.py"
409+
410+
```python hl_lines="12"
411+
from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore
412+
413+
app_config = AppConfigStore(
414+
environment="dev",
415+
application="product-catalogue",
416+
name="configuration",
417+
envelope = "feature_flags"
418+
)
419+
420+
feature_flags = FeatureFlags(store=app_config)
421+
422+
config = app_config.get_raw_configuration
423+
```
424+
382425
### Schema
383426

384427
This utility expects a certain schema to be stored as JSON within AWS AppConfig.
@@ -497,23 +540,6 @@ Now that you've seen all properties of a feature flag schema, this flowchart des
497540

498541
![Rule engine ](../media/feature_flags_diagram.png)
499542

500-
### Adjusting in-memory cache
501-
502-
By default, we cache configuration retrieved from the Store for 5 seconds for performance and reliability reasons.
503-
504-
You can override `max_age` parameter when instantiating the store.
505-
506-
```python hl_lines="7"
507-
from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore
508-
509-
app_config = AppConfigStore(
510-
environment="dev",
511-
application="product-catalogue",
512-
name="features",
513-
max_age=300
514-
)
515-
```
516-
517543
### Envelope
518544

519545
There are scenarios where you might want to include feature flags as part of an existing application configuration.
@@ -564,26 +590,6 @@ For this to work, you need to use a JMESPath expression via the `envelope` param
564590
}
565591
```
566592

567-
### Getting fetched configuration
568-
569-
You can access the configuration fetched from the store via `get_raw_configuration` property within the store instance.
570-
571-
=== "app.py"
572-
573-
```python hl_lines="12"
574-
from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore
575-
576-
app_config = AppConfigStore(
577-
environment="dev",
578-
application="product-catalogue",
579-
name="configuration",
580-
envelope = "feature_flags"
581-
)
582-
583-
feature_flags = FeatureFlags(store=app_config)
584-
585-
config = app_config.get_raw_configuration
586-
```
587593

588594
### Built-in store provider
589595

0 commit comments

Comments
 (0)