Kongfig allow declarative configuration. We can define our list of APIs and consumers in json/yaml and then run kongfig to ensure that our Kong is configured correctly.
At the simplest form, your config.yml can be just :
---
apis:
-
name: "mockbin"
attributes:
upstream_url: "http://mockbin.com/"
request_host: "mockbin.com"
There are 4 top level keys available :
| Key | Description |
|---|---|
apis |
List all of your micros APIs |
consumers |
List of required consumers |
plugins |
List of global plugins |
host |
Kong Admin API Host |
headers |
List of custom headers to be included with every request made by Kongfig |
Most of the time, you will only need to specifiy apis and consumers, and we'll walkthrough them below.
The apis contains an array of your APIs definition. There are 4 top level keys available for each API definition :
| Key | Description |
|---|---|
name |
The API name. |
ensure |
The flag of the API. Available values are present and removed, default to present |
attributes |
List of API attributes |
plugins |
List of API plugins |