flea1lt opened a new issue, #11340:
URL: https://github.com/apache/apisix/issues/11340
### Description
Comment in `config.yaml` shows that APISIX support use environment variables
in yaml
```
# To configure via environment variables, you can use `${{VAR}}` syntax. For
instance:
#
# deployment:
# role: traditional
# role_traditional:
# config_provider: etcd
# etcd:
# host:
# - http://${{ETCD_HOST}}:2379
```
But in `config-defautl.yaml`, it does not work.
```
-- apisix/cli/file.lua
local default_conf = yaml.load(default_conf_yaml)
if not default_conf then
return nil, "invalid config-default.yaml file"
end
local_conf_path = profile:customized_yaml_path()
if not local_conf_path then
local_conf_path = profile:yaml_path("config")
end
local user_conf_yaml, err = util.read_file(local_conf_path)
if not user_conf_yaml then
return nil, err
end
local is_empty_file = true
for line in str_gmatch(user_conf_yaml .. '\n', '(.-)\r?\n') do
if not is_empty_yaml_line(line) then
is_empty_file = false
break
end
end
if not is_empty_file then
local user_conf = yaml.load(user_conf_yaml)
if not user_conf then
return nil, "invalid config.yaml file"
end
local ok, err = resolve_conf_var(user_conf)
if not ok then
return nil, err
end
ok, err = merge_conf(default_conf, user_conf)
if not ok then
return nil, err
end
end
```
The ${{ VAR }} syntax is processed by `resolve_conf_var`, but it is only
called for user_conf.
To support it in config-default.yaml, run `resolve_conf_var` for
default_conf as well.
--
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]