Hi guys,
I am running into an issue while trying to write a kong.yml to run kong in db less mode. Generally the configuration file is working. I’ve tried it with a simple service following this article. Now I want to dive deeper into the configuration file by migrating my other services, routes, plugins.
plugins:
- name: cors
config:
- origins:
- '*'
methods:
- GET
- HEAD
- PUT
- PATCH
- POST
- DELETE
headers:
- Origin
- Accept
- Content-Type
- X-Auth-Token
- Authorization
- X-Userinfo
- X-Access-Token
- X-Id-Token
max_age: 3600
preflight_continue: false
Above you can see a part of my kong.yml which I am using to create a global plugin. After I added the configuration file to my kong container and started the container I received the following error message:
2019/10/25 13:09:48 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:382: error parsing declarative config file kong.yml:
kong_1 | in ‘plugins’:
kong_1 | - in entry 1 of ‘plugins’:
kong_1 | in ‘config’:
kong_1 | - in entry 1 of ‘config’: unknown field
After reading the error message the error can be simply identified by a wrong field declaration.
So my question is what the appropriate notation or appropriate field name would be to define a global plugin in my kong.yml with some configurations?
Down below you can find my complete kong.yml. The only changes I did to the original yaml before sharing it here is swapping the Host-IP with localhost.
Any help is highly appreciated!
Kind regards,
eddysTime
_format_version: '1.1'
services:
- name: test-service
url: http://localhost:5555
path: /
plugins:
- name: prometheus
routes:
- name: test-route
paths:
- /pepsi
strip_path: false
methods:
- GET
- POST
- OPTIONS
- name: botframework-service
url: http://localhost:9000
path: /api/sendRequest/botframework
plugins:
- name: prometheus
routes:
- name: botframework-route
paths:
- /bot
strip_path: true
methods:
- GET
- name: coke-service
url: http://localhost:5555
path: /
routes:
- name: coke-route
paths:
- /coke
strip_path: false
methods:
- GET
- POST
- OPTIONS
plugins:
- name: cors
configs:
- origins:
- '*'
methods:
- GET
- HEAD
- PUT
- PATCH
- POST
- DELETE
headers:
- Origin
- Accept
- Content-Type
- X-Auth-Token
- Authorization
- X-Userinfo
- X-Access-Token
- X-Id-Token
max_age: 3600
preflight_continue: false
- name: oidc
configs:
- client_id: kong
client_secret: '5fd50a43-8654-4726-aae3-83b2c4468fe5'
discovery: http://localhost:8180/auth/realms/master/.well-known/openid-configuration
introspection_endpoint: http://localhost:8180/auth/realms/master/protocol/openid-connect/token/introspect
bearer_only: 'yes'
- name: prometheus