Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve onboarding #150

Merged
merged 3 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- name: Go vet
run: go vet ./...
- name: Run all tests
timeout-minutes: 1
run: go test -race -covermode atomic -coverprofile=profile.cov -v ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ go get github.com/Unleash/unleash-client-go

The easiest way to get started with Unleash is to initialize it early in your application code:

**Asynchronous initialization example:**
```go
import (
"github.com/Unleash/unleash-client-go/v4"
Expand All @@ -49,6 +50,26 @@ func init() {
}
```

**Synchronous initialization example:**

```go
import (
"github.com/Unleash/unleash-client-go/v4"
)

func init() {
unleash.Initialize(
unleash.WithListener(&unleash.DebugListener{}),
unleash.WithAppName("my-application"),
unleash.WithUrl("http://unleash.herokuapp.com/api/"),
unleash.WithCustomHeaders(http.Header{"Authorization": {"<API token>"}}),
)

// Note this will block until the default client is ready
unleash.WaitForReady()
}
```

#### Preloading feature toggles

If you'd like to prebake your application with feature toggles (maybe you're working without persistent storage, so Unleash's backup isn't available), you can replace the defaultStorage implementation with a BootstrapStorage. This allows you to pass in a reader to where data in the format of `/api/client/features` can be found.
Expand Down
Loading