Skip to main content
Version: v1.40.0

GitLab

Overview​

Fetch the configuration from files stored in a Gitlab repository. This retriever will perform an HTTP Request with your Gitlab configuration on the Gitlab API to get your flags.
tip

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

Configure the relay proxy​

To configure your relay proxy to use the GitLab retriever, you need to add the following configuration to your relay proxy configuration file:

goff-proxy.yaml
# ...
retrievers:
- kind: gitlab
repositorySlug: thomaspoignant/go-feature-flag
path: config/flag/my-flags.yaml
# ...
Field nameMandatoryTypeDefaultDescription
kindstringnoneValue should be gitlab.
This field is mandatory and describes which retriever you are using.
repositorySlugstringnoneThe repository slug of the GitLab repository where your file is located (ex: thomaspoignant/go-feature-flag).
pathstringnonePath to the file inside the repository (ex: config/flag/my-flags.yaml).
baseUrlstringhttps://gitlab.comThe base URL of your GitLab instance.
branchstringmainThe branch we should check in the repository.
tokenstringnoneGitLab personal access token used to access a private repository (Create a personal access token).
timeoutstring10000Timeout in millisecond used when calling GitLab.

Configure the GO Module​

To configure your GO module to use the GitLab retriever, you need to add the following configuration to your ffclient.Config{} object:

example.go
err := ffclient.Init(ffclient.Config{
PollingInterval: 3 * time.Second,
Retriever: &gitlabretriever.Retriever{
RepositorySlug: "thomaspoignant/go-feature-flag",
Branch: "main",
FilePath: "testdata/flag-config.goff.yaml",
GitlabToken: "XXXX",
Timeout: 2 * time.Second,
BaseURL: "https://gitlab.com",
},
})
defer ffclient.Close()
FieldMandatoryDescription
BaseURLThe domain name of your Gitlab instance
Default: https://gitlab.com
RepositorySlugYour Gitlab slug org/repo-name.
FilePathThe path of your file.
BranchThe branch where your file is.
Default: main
GitlabTokenGitLab token is used to access a private repository
TimeoutTimeout for the HTTP call
Default: 10 seconds