|
2 | 2 |
|
3 | 3 | Covers advanced topics (different config options and scenarios) |
4 | 4 |
|
| 5 | +## Configuration Options |
| 6 | +The following configuration options are available to control the behaviour of the SDK. |
| 7 | +You can pass the configuration in as options when the SDK client is created. |
| 8 | +```python |
| 9 | + # Create a Feature Flag Client |
| 10 | + client = CfClient(apiKey, |
| 11 | + with_base_url("https://config.ff.harness.io/api/1.0"), |
| 12 | + with_events_url("https://events.ff.harness.io/api/1.0"), |
| 13 | + with_stream_enabled(True), |
| 14 | + with_analytics_enabled(True), |
| 15 | + Config(pull_interval=60)) |
| 16 | +``` |
| 17 | + |
| 18 | +| Name | Config Option | Description | default | |
| 19 | +|-----------------|----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------| |
| 20 | +| baseUrl | with_base_url("https://config.ff.harness.io/api/1.0") | the URL used to fetch feature flag evaluations. You should change this when using the Feature Flag proxy to http://localhost:7000 | https://config.ff.harness.io/api/1.0 | |
| 21 | +| eventsUrl | with_events_url("https://events.ff.harness.io/api/1.0"), | the URL used to post metrics data to the feature flag service. You should change this when using the Feature Flag proxy to http://localhost:7000 | https://events.ff.harness.io/api/1.0 | |
| 22 | +| pollInterval | Config(pull_interval=60) | when running in stream mode, the interval in seconds that we poll for changes. | 60 | |
| 23 | +| enableStream | with_stream_enabled(True), | Enable streaming mode. | true | |
| 24 | +| enableAnalytics | with_analytics_enabled(True) | Enable analytics. Metrics data is posted every 60s | true | |
| 25 | + |
| 26 | +## Logging Configuration |
| 27 | +The SDK provides a logger that wraps the standard python logging package. You can import and use it with: |
| 28 | +```python |
| 29 | +from featureflags.util import log |
| 30 | +log.info("Hello, World!") |
| 31 | +``` |
| 32 | + |
| 33 | +If you want to change the default log level, you can use the standard logging levels |
| 34 | +```python |
| 35 | +from featureflags.util import log |
| 36 | +import logging |
| 37 | + |
| 38 | +log.setLevel(logging.WARN) |
| 39 | +``` |
| 40 | + |
5 | 41 | ## Recommended reading |
6 | 42 |
|
7 | 43 | [Feature Flag Concepts](https://ngdocs.harness.io/article/7n9433hkc0-cf-feature-flag-overview) |
|
0 commit comments