codjust commented on a change in pull request #1022: Feature/chash key support more flexible ways URL: https://github.com/apache/incubator-apisix/pull/1022#discussion_r363280855
########## File path: lua/apisix/admin/upstreams.lua ########## @@ -28,6 +28,59 @@ local _M = { } +local function get_chash_key_schema(hash_on) + if not hash_on then + return nil, "hash_on is nil" + end + + if hash_on == "vars" then + return core.schema.upstream_hash_vars_schema + end + + if hash_on == "header" or hash_on == "cookie" then + return core.schema.upstream_hash_header_schema + end + + if hash_on == "consumer" then + return nil, nil + end + + return nil, "invalid hash_on type " .. hash_on +end + + +local function check_upstream_conf(conf) + local ok, err = core.schema.check(core.schema.upstream, conf) + if not ok then + return false, {error_msg = "invalid configuration: " .. err} + end + + if conf.type == "chash" then Review comment: ok, got it. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services