Skip to content

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

Merged
spacewander merged 5 commits intoapache:masterfrom
wilson-1024:issues5244
Mar 8, 2022
Merged

feat: support for reading environment variables from yaml configuration files #5244#6505
spacewander merged 5 commits intoapache:masterfrom
wilson-1024:issues5244

Conversation

@wilson-1024
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

end
end

if default_conf.apisix.config_center == "yaml" then
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

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
Copy Markdown
Contributor Author

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

tokers
tokers previously approved these changes Mar 6, 2022
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 requested a review from tzssangglass 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