undying commented on code in PR #12187:
URL: https://github.com/apache/apisix/pull/12187#discussion_r2124362620
##########
apisix/upstream.lua:
##########
@@ -297,7 +297,12 @@ function _M.set_by_route(route, api_ctx)
return 503, err
end
- local new_nodes, err = dis.nodes(up_conf.service_name,
up_conf.discovery_args)
+ local service_name, err = core.utils.resolve_var(up_conf.service_name,
api_ctx.var)
Review Comment:
> Just a reminder that you don't check the third return value of
resolve_var. It indicates that several variables in the template have been
replaced.
I'm not sure that I need to check that. User may construct service name from
multiple variables and this is fine (for me at least). But thanks for noticing
this.
> If your template contains only one variable and its value is empty,
service name will be replaced with an empty string. I'm not sure if this is
what you expect.
Good point, thank you! I'll fix with a check that value is not an empty
string.
--
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]