is mostly useful for dynamic servers created on the CLI which by default
ignore any default-server, which is equivalent to the "none" value.
- srv:[<bename>/]<srvname>
- instructs to reuse the settings from the designated backend's server or named
- default-server resulting from the processing of all its default-server
- directives using the same name. The backend name is optional. If unset,
- this designates the proxy where the currently newly defined server will
- be attached.
+ instructs to reuse the settings from the designated backend's server or
+ named default-server resulting from the processing of all its
+ default-server directives using the same name. The backend name is
+ optional. If unset, this designates the proxy where the currently newly
+ defined server will be attached. Alternatively, a named defaults section
+ can also be specified to inherit from a named default-server. Only a
+ server or named default-server directly declared in the target backend or
+ defaults section can be specified; inherited entries are not resolved.
The currently supported server settings are the following ones. Note that all
these settings are supported both by "server" and "default-server" keywords,
thread-groups 1
.endif
+ defaults defpx
+ default-server name srv weight 20
+
defaults
mode http
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
default-server name other weight 5
server srvconf7 ${s1_addr}:${s1_port} from srv:other
+ # inherit from a defaults section
+ server srvconf8 ${s1_addr}:${s1_port} from srv:defpx/srv
+
backend be_defempty
default-server check
# reset default-server will be purged on post parsing
send "get weight be/srvconf7"
expect ~ "5 \\(initial 5\\)"
+
+ send "get weight be/srvconf8"
+ expect ~ "20 \\(initial 20\\)"
}
# dynamic servers
{
struct server *srv;
struct ist be_name;
+ const char *be_name0;
struct proxy *px = curproxy;
if (istchr(sv_name, '/')) {
be_name = istsplit(&sv_name, '/');
- px = proxy_be_by_name(ist0(be_name));
+ be_name0 = ist0(be_name);
+
+ px = proxy_be_by_name(be_name0);
+ if (!px)
+ px = proxy_find_by_name(be_name0, PR_CAP_DEF, 0);
if (!px) {
- memprintf(msg, "unknown backend '%s'", istptr(be_name));
+ memprintf(msg, "unknown backend or defaults '%s'", istptr(be_name));
return NULL;
}
}