Skip to main content
Version: v1.5.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.

Example

err := ffclient.Init(ffclient.Config{
PollingInterval: 3 * time.Second,
Retriever: &githubretriever.Retriever{
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