wayne-cheng commented on pull request #4856:
URL: https://github.com/apache/apisix/pull/4856#issuecomment-903545790


   @spacewander 
   The config `apisix.node_listen` in previous `config-default.yaml` is the 
type number, but the new has been the  type table. 
   If a user still uses the type number to set the config `apisix.node_listen` 
like this:
   ```yaml
   apisix:
     node_listen: 9081
   ```
   The error will occur when exec `make init`,and it also appeared in the CI 
test:
   ```shell
   ./bin/apisix init
   /usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua init
   failed to read local yaml config of apisix: failed to merge, 
path[apisix->ssl->listen] expect: table, but got: number
   make: *** [Makefile:127: init] Error 1
   ```
   This bug should have existed before, but it was missed, since the previous 
file `config-default.yaml` used the number type.
   Should I fix the function `merge_conf` in the code file 
`apisix/cli/file.lua`(+151) ?
   ```lua
    -- ...           
               elseif type(base[key]) ~= type_val then
                   if (ppath == "nginx_config" or str_sub(ppath, 1, 14) == 
"nginx_config->") and
                       (type_val == "number" or type_val == "string")
                   then
                       base[key] = val
                   else
                       local path = ppath == "" and key or ppath .. "->" .. key
                       return nil, "failed to merge, path[" .. path ..  "] 
expect: " ..
                                   type(base[key]) .. ", but got: " .. type_val
                   end
               else
                   base[key] = val
               end
   -- ...
   ```


-- 
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]


Reply via email to