Skip to content

Commit

Permalink
docs: rearrange advanced sections based on popularity
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorlessa committed Dec 31, 2021
1 parent 801c6b9 commit 39c8dd6
Showing 1 changed file with 43 additions and 37 deletions.
80 changes: 43 additions & 37 deletions docs/utilities/feature_flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,49 @@ You can use `get_enabled_features` method for scenarios where you need a list of

## Advanced

### Adjusting in-memory cache

By default, we cache configuration retrieved from the Store for 5 seconds for performance and reliability reasons.

You can override `max_age` parameter when instantiating the store.

```python hl_lines="7"
from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore

app_config = AppConfigStore(
environment="dev",
application="product-catalogue",
name="features",
max_age=300
)
```

### Getting fetched configuration

???+ info "When is this useful?"
You might have application configuration in addition to feature flags in your store.

This means you don't need to make another call only to fetch app configuration.

You can access the configuration fetched from the store via `get_raw_configuration` property within the store instance.

=== "app.py"

```python hl_lines="12"
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
```

### Schema

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

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

### Adjusting in-memory cache

By default, we cache configuration retrieved from the Store for 5 seconds for performance and reliability reasons.

You can override `max_age` parameter when instantiating the store.

```python hl_lines="7"
from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore

app_config = AppConfigStore(
environment="dev",
application="product-catalogue",
name="features",
max_age=300
)
```

### Envelope

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

### Getting fetched configuration

You can access the configuration fetched from the store via `get_raw_configuration` property within the store instance.

=== "app.py"

```python hl_lines="12"
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
```

### Built-in store provider

Expand Down

0 comments on commit 39c8dd6

Please sign in to comment.