Skip to content

Latest commit

 

History

History
102 lines (86 loc) · 2.41 KB

File metadata and controls

102 lines (86 loc) · 2.41 KB
title File Provider
description The file provider reads dynamic configuration from a single file or multiple files.

File

The file provider reads dynamic configuration from a single file or multiple files.

Configuration Example

providers:
  file:
    directory: /path/to/dynamic/config
--providers-file-directory /path/to/dynamic/config
MOKAPI_PROVIDERS_FILE_DIRECTORY=/path/to/dynamic/config
You also can use CLI JSON or shorthand syntax to, see [CLI](/docs/configuration/static/cli.md)

Provider Configuration

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

Mokapi uses fsnotify to listen to file system notification. There
are issues with if Mokapi runs in a Linux Docker container on Windows
WSL2 host system.

Filename

Defines the path to the configuration file.

providers:
  file:
    filename: foobar.yaml
--providers-file-filename foobar.yaml
MOKAPI_PROVIDERS_FILE_FILENAME=foobar.yaml

Directory

Defines the path to the directory that contains the configuration files. You can also organize your configuration files in subdirectories.

providers:
  file:
    directory: /foobar
--providers-file-directory /foobar
MOKAPI_PROVIDERS_FILE_DIRECTORY=/foobar
You can define multiple file names or directory using CLI JSON or shorthand syntax, see [CLI](/docs/configuration/static/cli.md)
You can also define multiple file names or directory by separating them with system's path separator
(Unix=':', Windows=';')

Include

One or more patterns that a file must match, except when empty. The filter is only applied to files.

providers:
  file:
    include: ["*.json", "*.yaml"]
--providers-file-include *.json *.yaml
MOKAPI_PROVIDERS_FILE_INCLUDE="*.json *.yaml"

Ignoring Files and Directories

You can create a .mokapiignore file in your directory to tell Mokapi which files and directories to ignore. The structure of this file follows the gitignore specification

Example to exclude everything except a specific directory foo

/*
!/foo