Skip to main content
Version: v0.20.0

Github

The GithubRetriever will perform an HTTP Request with your GitHub configuration to get your flags.

tip

GitHub has rate limits, be sure to correctly set your PollingInterval to avoid reaching the limit.

Example

err := ffclient.Init(ffclient.Config{
PollingInterval: 3 * time.Second,
Retriever: &ffclient.GithubRetriever{
RepositorySlug: "thomaspoignant/go-feature-flag",
Branch: "main",
FilePath: "testdata/flag-config.yaml",
GithubToken: "XXXX",
Timeout: 2 * time.Second,
},
})
defer ffclient.Close()

Configuration fields

To configure the access to your GitHub file:

FieldDescription
RepositorySlugYour GitHub slug org/repo-name.
FilePathThe path of your file.
Branch(optional)
The branch where your file is.
Default: main
GithubToken(optional)
Github token is used to access a private repository, you need the repo permission (how to create a GitHub token).
Timeout(optional)
Timeout for the HTTP call
Default: 10 seconds

Get the latest GO Feature Flag updates