apisix icon indicating copy to clipboard operation
apisix copied to clipboard

I don't want to set up different config-default.yaml for different environments

Open griffenliu opened this issue 6 years ago • 9 comments

Issue description

config template is a very good idea. But I don't want set up config-default-dev.yaml for dev env when APISIX_PROFILE=dev. I want to use the same config-default.yaml for both development and production environments. But I can still use the config.yaml on production env, and the config-dev.yaml on development env.

Environment

  • apisix version (cmd: apisix version): 2.0
  • OS: Ubuntu

griffenliu avatar Nov 05 '20 06:11 griffenliu

@membphis Should we use the same config-default.yaml for different profiles?

spacewander avatar Nov 05 '20 06:11 spacewander

I has the second problem: when i custom config in the config.yaml. it can't merge. and has some errors. I found the problem code in the apisix script:

local function merge_conf(base, new_tab)
    for key, val in pairs(new_tab) do
        if type(val) == "table" then
            if tab_is_array(val) then
                base[key] = val
            else
                merge_conf(base[key], val)
            end
        else
            base[key] = val
        end
    end
    return base
end

can we add custom config support in the config.yaml?

griffenliu avatar Nov 05 '20 07:11 griffenliu

@griffenliu Do you mean https://github.com/apache/apisix/pull/2476?

spacewander avatar Nov 05 '20 08:11 spacewander

@spacewander yes, #2476 seems to solve my problem, thanks.

griffenliu avatar Nov 05 '20 08:11 griffenliu

Its title should be "DISCUSS". I think the second question should be raised as another issue, but since it has been fixed, just ignore it :-D

idbeta avatar Nov 05 '20 09:11 idbeta

@membphis Should we use the same config-default.yaml for different profiles?

for config-default.yaml, only one version. we use the same config-default.yaml for different profiles.

membphis avatar Nov 05 '20 13:11 membphis

@griffenliu please feel free to reopen this issue if you still have a question for this issue.

membphis avatar Nov 05 '20 13:11 membphis

@membphis Should we use the same config-default.yaml for different profiles?

for config-default.yaml, only one version. we use the same config-default.yaml for different profiles.

But when i use the apisix version 2.0 and profile is dev. when apisix start, it required config-default-dev.yaml.

local function read_yaml_conf()
    local profile = require("apisix.core.profile")
    profile.apisix_home = apisix_home .. "/"
    local local_conf_path = profile:yaml_path("config-default")

griffenliu avatar Nov 06 '20 07:11 griffenliu

But when i use the apisix version 2.0 and profile is dev. when apisix start, it required config-default-dev.yaml.

let us fix it, I think that is a bug.

membphis avatar Nov 06 '20 15:11 membphis