spacewander commented on a change in pull request #5675:
URL: https://github.com/apache/apisix/pull/5675#discussion_r762511228
##########
File path: conf/config.yaml
##########
@@ -30,6 +30,16 @@
# And then run `export ETCD_HOST=$your_host` before `make init`.
#
# If the configured environment variable can't be found, an error will be
thrown.
+#
+# Also, If you want to use default value when the environment variable not set,
+# Use `${{VAR::default_value}}` instead. For instance:
Review comment:
I am curious why `::` is chosen as the separator. It is different from
the common way. Is there a special reason behind it?
##########
File path: apisix/cli/file.lua
##########
@@ -65,8 +65,15 @@ local function resolve_conf_var(conf)
local var_used = false
-- we use '${{var}}' because '$var' and '${var}' are taken
-- by Nginx
- local new_val = val:gsub("%$%{%{%s*([%w_]+)%s*%}%}", function(var)
- local v = getenv(var)
+ local new_val =
val:gsub("%$%{%{%s*([%w_]+[%:%:[%w%-%.%:%?%/=]+]?)%s*%}%}", function(var)
Review comment:
Why do we need a regex to check the default variable?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]