Skip to content

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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:

Field Description
RepositorySlug Your GitHub slug org/repo-name.
FilePath The 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