Skip to main content
Version: v1.36.1

GitHub

The GitHub Retriever 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.

If the rate limit is reached, the retriever will return an error and will stop polling until GitHub allows it again.

Example

err := ffclient.Init(ffclient.Config{
PollingInterval: 3 * time.Second,
Retriever: &githubretriever.Retriever{
RepositorySlug: "thomaspoignant/go-feature-flag",
Branch: "main",
FilePath: "testdata/flag-config.goff.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