Skip to content

Commit 79a45e1

Browse files
committed
Usage instructions
Signed-off-by: Rob Crowe <nobby.crowe@gmail.com>
1 parent dcf8d5c commit 79a45e1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

providers/configcat/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ConfigCat OpenFeature provider for Go
2+
3+
## Installation
4+
5+
```shell
6+
# ConfigCat SDK
7+
go get github.com/configcat/go-sdk/v7
8+
9+
# OpenFeature SDK
10+
go get github.com/open-feature/go-sdk/pkg/openfeature
11+
go get github.com/open-feature/go-sdk-contrib/providers/configcat
12+
```
13+
14+
## Usage
15+
16+
Here's a basic example:
17+
18+
```go
19+
import (
20+
"context"
21+
"fmt"
22+
23+
sdk "github.com/configcat/go-sdk/v7"
24+
configcat "github.com/open-feature/go-sdk-contrib/providers/configcat/pkg"
25+
"github.com/open-feature/go-sdk/pkg/openfeature"
26+
)
27+
28+
func main() {
29+
provider := configcat.NewProvider(sdk.NewClient("..."))
30+
openfeature.SetProvider(provider)
31+
32+
client := openfeature.NewClient("app")
33+
34+
val, err := client.BooleanValue(context.Background(), "flag_name", false, openfeature.NewEvaluationContext("123", map[string]any{
35+
configcat.EmailKey: "test@example.com",
36+
}))
37+
fmt.Printf("val: %+v - error: %v\n", val, err)
38+
}
39+
```

0 commit comments

Comments
 (0)