Skip to content

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.

NOTE

The retriever handles URL encoding, so write the repository slug and the file path as they appear in GitLab:

  • repositorySlug / RepositorySlug: group/subgroup/project, not group%2Fsubgroup%2Fproject.
  • path / FilePath: flag configs/my flags.yaml, without replacing spaces with %20 or +.

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:

yaml
# ...
retrievers:
  - kind: gitlab
    repositorySlug: your-org/your-repo
    path: config/flag/my-flags.yaml
# ...
Field nameMandatoryTypeDefaultDescription
kindYesstringnoneValue should be gitlab.
This field is mandatory and describes which retriever you are using.
repositorySlugYesstringnoneThe repository slug of the GitLab repository where your file is located (ex: your-org/your-repo).
pathYesstringnonePath to the file inside the repository (ex: config/flag/my-flags.yaml).
baseUrlNostringhttps://gitlab.comThe base URL of your GitLab instance.
branchNostringmainThe branch we should check in the repository.
tokenNostringnoneGitLab personal access token used to access a private repository (Create a personal access token).
timeoutNostring10000Timeout 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:

go
client, err := ffclient.New(&ffclient.Config{
    PollingInterval: 3 * time.Second,
    Retriever: &gitlabretriever.Retriever{
        RepositorySlug: "your-org/your-repo",
        Branch: "main",
        FilePath: "testdata/flag-config.yaml",
        GitlabToken: "XXXX",
        Timeout: 2 * time.Second,
		    BaseURL: "https://gitlab.com",
    },
})
defer client.Close()
FieldMandatoryDescription
BaseURLNoThe domain name of your Gitlab instance
Default: https://gitlab.com
RepositorySlugYesYour Gitlab slug org/repo-name.
FilePathYesThe path of your file.
BranchNoThe branch where your file is.
Default: main
GitlabTokenNoGitLab token is used to access a private repository
TimeoutNoTimeout for the HTTP call
Default: 10 seconds

Released under the MIT License.