MINOR: proxy: parse guid on dynamic backend creation

Defines an extra optional GUID argument for "add backend" command. This
can be useful as it is not possible to define it via a default proxy
instance.
This commit is contained in:
Amaury Denoyelle 2026-01-13 16:13:27 +01:00
parent e152913327
commit a603811aac
2 changed files with 9 additions and 4 deletions

View file

@ -1725,13 +1725,14 @@ add acl [@<ver>] <acl> <pattern>
This command cannot be used if the reference <acl> is a name also used with
a map. In this case, the "add map" command must be used instead.
add backend <name> from <defproxy> [mode <mode>] [ EXPERIMENTAL ]
add backend <name> from <defproxy> [mode <mode>] [guid <guid>] [ EXPERIMENTAL ]
Instantiate a new backend proxy with the name <name>.
Only TCP or HTTP proxies can be created. All of the settings are inherited
from <defproxy> default proxy instance. By default, it is mandatory to
specify the backend mode via the argument of the same name, unless <defproxy>
already defines it explicitely.
already defines it explicitely. It is also possible to use an optional GUID
argument if wanted.
Servers can be added via the command "add server". The backend is initialized
in the unpublished state. Once considered ready for traffic, use "publish

View file

@ -4787,7 +4787,7 @@ static int cli_parse_shutdown_frontend(char **args, char *payload, struct appctx
static int cli_parse_add_backend(char **args, char *payload, struct appctx *appctx, void *private)
{
struct proxy *px, *defpx;
const char *be_name, *def_name, *err;
const char *be_name, *def_name, *guid = NULL, *err;
char *msg = NULL;
enum pr_mode mode = 0;
@ -4829,9 +4829,13 @@ static int cli_parse_add_backend(char **args, char *payload, struct appctx *appc
return 1;
}
}
/* guid */
else if (*args[2] && !guid && strcmp(args[1], "guid") == 0) {
guid = args[2];
}
/* unknown, malformed or duplicate argument */
else {
cli_err(appctx, "Usage: add backend <name> from <defproxy> [mode <px_mode>].\n");
cli_err(appctx, "Usage: add backend <name> from <defproxy> [mode <px_mode>] [guid <val>].\n");
return 1;
}