Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using custom Kong Configuration #558

Open
venkatb-zelar opened this issue May 3, 2024 · 7 comments
Open

Using custom Kong Configuration #558

venkatb-zelar opened this issue May 3, 2024 · 7 comments

Comments

@venkatb-zelar
Copy link

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
@Tieske
Copy link
Member

Tieske commented May 3, 2024

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

@venkatb-zelar
Copy link
Author

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.

@Tieske
Copy link
Member

Tieske commented May 3, 2024

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

@venkatb-zelar
Copy link
Author

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?

@Tieske
Copy link
Member

Tieske commented May 3, 2024

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

@venkatb-zelar
Copy link
Author

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.

@Tieske
Copy link
Member

Tieske commented May 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants