Skip to content

Latest commit

 

History

History
159 lines (127 loc) · 4.18 KB

File metadata and controls

159 lines (127 loc) · 4.18 KB
title GIT Provider for dynamic configuration
description Pull your dynamic configuration from a GIT repository.

GIT

Pull your dynamic configuration from a GIT repository.

After cloning a GIT repository Mokapi uses the <a href="/docs/configuration/dynamic/file">File Provider</a> to read the
containing files.

Configuration Example

providers:
  git:
    url: https://github.com//PATH-TO/REPOSITORY
--providers-git-url https://github.com//PATH-TO/REPOSITORY
MOKAPI_PROVIDERS_GIT_URL=https://github.com//PATH-TO/REPOSITORY

Provider Configuration

A list of all options that can be used with the GIT provider, refer to the reference page.

URL

Defines the URL to the GIT repository. With the query parameter ref you can specify an alternative branch.

providers:
  git:
    url: https://github.com/PATH-TO/REPOSITORY?ref=branch-name
--providers-git-url="https://github.com/PATH-TO/REPOSITORY?ref=branch-name"
MOKAPI_PROVIDERS_GIT_URL=https://github.com/PATH-TO/REPOSITORY?ref=branch-name

Pull Interval

Defines in which interval Mokapi pulls possible changes, default 3 minutes. Valid time units are ns, us (or µs), ms, s, m, h.

providers:
  git:
    pullInterval: 3m30s
--providers-git-pull-interval 3m30s
MOKAPI_PROVIDERS_GIT_PULL-INTERVAL=3m30s

Advanced Repository Settings

providers:
  repositories:
    - url: https://github.com/PATH-TO/REPOSITORY
      pullInterval: 5m
--providers-git-repositories[0]-url="https://github.com/PATH-TO/REPOSITORY" --providers.git.repositories[0].pullInterval="5m"
MOKAPI_PROVIDERS_GIT_REPOSITORIES[0]_URL=https://github.com/PATH-TO/REPOSITORY
MOKAPI_PROVIDERS_GIT_REPOSITORIES[0]_PULL_INTERVAL=5m

Files

Specifies an allow list of files. Mokapi will only read these files.

providers:
  git:
    repositories:
      - url: https://github.com/PATH-TO/REPOSITORY
        files: ['mokapi/api.json']

Include

Specifies an array of filenames or patterns. Mokapi will only read these files.

providers:
  git:
    repositories:
      - url: https://github.com/PATH-TO/REPOSITORY
        include: ['mokapi/**/*.json']

Pull Interval

Specifies a specific pull interval for this repository

providers:
  git:
    repositories:
      - url: https://github.com/PATH-TO/REPOSITORY
        pullInterval: 3m30s

TempDir

By default, Mokapi checks out all repositories to system's temp directory. You can use the tempDir option to override the default path.

Default path

  • On Unix systems, it uses $TMPDIR if non-empty, else /tmp.
  • On Windows, it uses the first non-empty value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory.
providers:
  git:
    url: https://github.com/PATH-TO/REPOSITORY?ref=branch-name
    tempDir: /path-to/repositories

GitHub App Authentication

providers:
  repositories:
    - url: https://github.com/PATH-TO/REPOSITORY
      auth:
        github:
          appId: 12345
          installationId: 123456789
          privateKey: 2024-2-25.private-key.pem

GitHub AppId

You can find your app's ID on the settings page for your GitHub App. Navigate to your Settings > Developer Settings > GitHub Apps > Your GitHub App > Edit.

GitHub InstallationId

Your installation ID can be found in the organization or user that you have installed your GitHub App too.

For users, please navigate to your Settings > Developer Settings > GitHub Apps > Your GitHub App > Edit > Install App > Configure Installation. The installation ID can be found at the end of the URL - if the URL is https://github.com/settings/installations/123456789, your installation id is 123456789

GitHub PrivateKey

Set content of your private key or path to your private key file. You can download your private key by navigating to Settings > Developer Settings > GitHub Apps > Your GitHub App > Edit