|
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 provide options by passing them in when the client is created e.g. |
| 8 | + |
| 9 | +```golang |
| 10 | +// Create Options |
| 11 | +client, err := harness.NewCfClient(myApiKey, |
| 12 | + harness.WithURL("https://config.ff.harness.io/api/1.0"), |
| 13 | + harness.WithEventsURL("https://events.ff.harness.io/api/1.0"), |
| 14 | + harness.WithPullInterval(1), |
| 15 | + harness.WithStreamEnabled(false)) |
| 16 | + |
| 17 | +``` |
| 18 | + |
| 19 | +| Name | Config Option | Description | default | |
| 20 | +|-----------------|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------| |
| 21 | +| baseUrl | harness.WithURL("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 | |
| 22 | +| eventsUrl | harness.WithEventsURL("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 | |
| 23 | +| pollInterval | harness.WithPullInterval(1)) | when running in stream mode, the interval in minutes that we poll for changes. | 60 | |
| 24 | +| enableStream | harness.WithStreamEnabled(false), | Enable streaming mode. | true | |
| 25 | +| enableAnalytics | *Not Supported* | Enable analytics. Metrics data is posted every 60s | *Not Supported* | |
| 26 | + |
| 27 | +## Logging Configuration |
| 28 | +You can provide your own logger to the SDK, passing it in as a config option. |
| 29 | +The following example creates an instance of the logrus logger and provides it as an option. |
| 30 | + |
| 31 | + |
| 32 | +```golang |
| 33 | +logger := logrus.New() |
| 34 | + |
| 35 | +// Create a feature flag client |
| 36 | +client, err := harness.NewCfClient(myApiKey, harness.WithLogger(logger)) |
| 37 | +``` |
| 38 | + |
5 | 39 | ## Recommended reading
|
6 | 40 |
|
7 | 41 | [Feature Flag Concepts](https://ngdocs.harness.io/article/7n9433hkc0-cf-feature-flag-overview)
|
|
0 commit comments