kong-pongo icon indicating copy to clipboard operation
kong-pongo copied to clipboard

Using custom Kong Configuration

Open venkatb-zelar opened this issue 10 months ago • 7 comments

Is is possible to customise the Kong configuration through a kong.conf file or through and environment variable?

for ex:

env:
  MY_CUSTOM_ENV: mycustomval

venkatb-zelar avatar May 03 '24 11:05 venkatb-zelar

in the tests you can specify enviornment variables, that will override whatever is in kong.conf

Tieske avatar May 03 '24 11:05 Tieske

But i need this during development. Let's say i want to connect to AWS secret manager, i'll have to add few environment variables.

venkatb-zelar avatar May 03 '24 11:05 venkatb-zelar

see here: https://github.com/Kong/kong-plugin/blob/master/spec/myplugin/02-integration_spec.lua#L29-L36

each entry in that table is exported. For example it has plugins = "...". that value will be exported as export "KONG_PLUGINS=..." before starting Kong.

This allows you to override all of the kong.conf file settings

Tieske avatar May 03 '24 11:05 Tieske

If i'm not wrong that will take affect only during test runs. But what if i want to do something like:

pongo up
pongo shell
kms

and then:

pongo expose

Make code code changes in the plugin and i need a custom config like said above?

venkatb-zelar avatar May 03 '24 11:05 venkatb-zelar

after you start the shell (before kms in your example) you can add them?

If you want to automate it you can use the initialization scripts. See https://github.com/Kong/kong-pongo?tab=readme-ov-file#test-initialization

Tieske avatar May 03 '24 13:05 Tieske

after you start the shell (before kms in your example) you can add them?

I tried but i think it has no affect.

If you want to automate it you can use the initialization scripts. See https://github.com/Kong/kong-pongo?tab=readme-ov-file#test-initialization

Again we are talking about tests here. And my requirement is not with tests but with development.

One hacky workaround is to simply add these env vars in the assets/docker-compose.yaml in the pongo source itself.

venkatb-zelar avatar May 03 '24 15:05 venkatb-zelar

the test initialization scripts run whenever a container is started, either on run or on shell. So that should work for your use case.

Please provide more details and exact commands you tried with expected and received output.

Tieske avatar May 04 '24 06:05 Tieske