Skip to content

Commit

Permalink
fix(demo): Updated the to the latest version of the sdk and broke out…
Browse files Browse the repository at this point in the history
… the client secret to be retrieved from the env (#72)

* fix(demo): Updated the to the latest version of the sdk and broke out the client secret to be retrieved from the env

* fix(demo): fixed context key

Co-authored-by: Nicklas Lundin <nicklasl@spotify.com>

---------

Co-authored-by: Nicklas Lundin <nicklasl@spotify.com>
  • Loading branch information
msvens and nicklasl authored Feb 10, 2025
1 parent 27cfc59 commit 8b62d67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion demo/GoDemoApp.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ func main() {
h := slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: programLevel})
slog.SetDefault(slog.New(h))

confidence := c.NewConfidenceBuilder().SetAPIConfig(*c.NewAPIConfig("CLIENT_SECRET")).Build()
// Read the client secret from env
clientkey := os.Getenv("CONFIDENCE_GO_CLIENT")
if clientkey == "" {
fmt.Println("No client key defined")
os.Exit(1)
}

confidence := c.NewConfidenceBuilder().SetAPIConfig(*c.NewAPIConfig(clientkey)).Build()
confidence.PutContext("targeting_key", "Random_targeting_key")
withAddedContext := confidence.WithContext(map[string]interface{}{
"Something": 343,
Expand Down
2 changes: 1 addition & 1 deletion demo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module demo

go 1.22.2

require github.com/spotify/confidence-sdk-go v0.2.3
require github.com/spotify/confidence-sdk-go v0.4.1

require golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect

Expand Down

0 comments on commit 8b62d67

Please sign in to comment.