-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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(cli): support reserved environment variable "APISIX_DEPLOYMENT_E… #8898
Conversation
@@ -115,6 +117,21 @@ end | |||
_M.resolve_conf_var = resolve_conf_var | |||
|
|||
|
|||
local function replace_by_reserved_env_vars(conf) | |||
-- TODO: support more reserved environment variables | |||
local v = getenv("APISIX_DEPLOYMENT_ETCD_HOST") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's an array, let's call it APISIX_DEPLOYMENT_ETCD_HOSTS
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it is a better idea that the variable name matches the configuration item?
deployment:
etcd:
host:
- xxx
=======
APISIX_DEPLOYMENT_ETCD_HOST
It's easier to be understood, and there is no need to add more detailed documents to describe this feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 Good point.
t/cli/test_main.sh
Outdated
exit 1 | ||
fi | ||
|
||
out=$(APISIX_DEPLOYMENT_ETCD_HOST='["http://127.0.0.1:2333"]' make run 2>&1 || true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you configure a connectable address and check if it works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this feature is broken, when I tried "valid host in env" + "invalid host in conf" + "make run".
@spacewander This case is covered by the latest commit and passed. |
I spend some time playing with this feature locally. Look like when APISIX is running, it will read the env variable in a different path. The CI stops APISIX too early, so APISIX doesn't have time to read it. |
@@ -51,6 +51,9 @@ worker_shutdown_timeout {* worker_shutdown_timeout *}; | |||
env APISIX_PROFILE; | |||
env PATH; # for searching external plugin runner's binary | |||
|
|||
# reserved environment variables for configuration | |||
env APISIX_DEPLOYMENT_ETCD_HOST; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find a way to cover it in the CI? So we don't need to spend time verifying it locally next time.
…TCD_HOST"
Description
The user can use env variable "APISIX_DEPLOYMENT_ETCD_HOST" to config the etcd.host.
Priority: env var > config.yaml
Checklist