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

feat: support for reading environment variables from yaml configuration files #5244 #6505

Merged
merged 5 commits into from
Mar 8, 2022

Conversation

wilson-1024
Copy link
Contributor

What this PR does / why we need it:

Support for reading environment variables from yaml configuration files.

resolve #5244

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

# check supported environment variables in apisix.yaml

yaml_config_variables_clean_up() {
git checkout conf/config.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the original clean up like:

serverless_clean_up() {
clean_up
git checkout conf/apisix.yaml
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Please review it again.

@@ -234,6 +237,20 @@ function _M.read_yaml_conf(apisix_home)
end
end

if default_conf.apisix.config_center == "yaml" then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this in apisix/core/config_yaml.lua?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first I wanted to put this in apisix/core/config_yaml.lua, but because the file loads ngx variables, it needs to be loaded in the openresty environment. Can't run in CLI mode, so we can't put this in apisix/core/config_yaml.lua

spacewander
spacewander previously approved these changes Mar 6, 2022
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename it to test_standalone.sh, so it can be used in other places later.

t/cli/test_yaml_config_variables.sh Outdated Show resolved Hide resolved
tokers
tokers previously approved these changes Mar 6, 2022
@wilson-1024 wilson-1024 dismissed stale reviews from tokers and spacewander via ace1514 March 6, 2022 12:13
@wilson-1024
Copy link
Contributor Author

@spacewander @tokers Test file renamed.Please review it again.

tokers
tokers previously approved these changes Mar 6, 2022
t/cli/test_standalone.sh Outdated Show resolved Hide resolved
t/cli/test_standalone.sh Outdated Show resolved Hide resolved
spacewander
spacewander previously approved these changes Mar 7, 2022
Co-authored-by: tzssangglass <tzssangglass@gmail.com>
@spacewander spacewander dismissed stale reviews from tokers and themself via 0c7f98b March 8, 2022 02:50
spacewander
spacewander previously approved these changes Mar 8, 2022
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

Successfully merging this pull request may close these issues.

Is it possible to read environment variables from yaml configuration files?
4 participants