The <server> name must not be already used in the backend. A special
restriction is put on the backend which must used a dynamic load-balancing
algorithm. A subset of keywords from the server config file statement can be
- used to configure the server behavior. Also note that no settings will be
- reused from an hypothetical 'default-server' statement in the same backend.
+ used to configure the server behavior (see "add server help" to list them).
+ Also note that no settings will be reused from an hypothetical
+ 'default-server' statement in the same backend.
Currently a dynamic server is statically initialized with the "none"
init-addr method. This means that no resolution will be undertaken if a FQDN
servers. Please refer to the "u-limit" global keyword documentation in this
case.
- Here is the list of the currently supported keywords :
-
- - agent-addr
- - agent-check
- - agent-inter
- - agent-port
- - agent-send
- - allow-0rtt
- - alpn
- - addr
- - backup
- - ca-file
- - check
- - check-alpn
- - check-proto
- - check-send-proxy
- - check-sni
- - check-ssl
- - check-via-socks4
- - ciphers
- - ciphersuites
- - cookie
- - crl-file
- - crt
- - disabled
- - downinter
- - error-limit
- - fall
- - fastinter
- - force-sslv3/tlsv10/tlsv11/tlsv12/tlsv13
- - id
- - init-state
- - inter
- - maxconn
- - maxqueue
- - minconn
- - no-ssl-reuse
- - no-sslv3/tlsv10/tlsv11/tlsv12/tlsv13
- - no-tls-tickets
- - npn
- - observe
- - on-error
- - on-marked-down
- - on-marked-up
- - pool-low-conn
- - pool-max-conn
- - pool-purge-delay
- - port
- - proto
- - proxy-v2-options
- - rise
- - send-proxy
- - send-proxy-v2
- - send-proxy-v2-ssl
- - send-proxy-v2-ssl-cn
- - slowstart
- - sni
- - source
- - ssl
- - ssl-max-ver
- - ssl-min-ver
- - tfo
- - tls-tickets
- - track
- - usesrc
- - verify
- - verifyhost
- - weight
- - ws
-
- Their syntax is similar to the server line from the configuration file,
- please refer to their individual documentation for details.
+add server help
+ List the keywords supported for dynamic servers by the current haproxy
+ version. Keyword syntax is similar to the server line from the configuration
+ file, please refer to their individual documentation for details.
add ssl ca-file <cafile> <payload>
Add a new certificate to a ca-file. This command is useful when you reached
/* Distinguish between "add server" default usage or one of its sub-commands. */
enum add_srv_mode {
ADD_SRV_MODE_DEF, /* default mode, IO handler should be skipped by parser. */
+ ADD_SRV_MODE_HELP, /* help mode to list supported keywords */
};
/* Context for "add server" CLI. */
void *obj2;
};
-/* Handler for "add server" command. Should be reserved to extra sub-commands. */
+/* Handler for "add server" command. Should be reserved to extra sub-commands
+ * such as "help".
+ */
int cli_io_handler_add_server(struct appctx *appctx)
{
struct add_srv_ctx *ctx = appctx->svcctx;
+ struct srv_kw_list *kwl = ctx->obj1;
+ struct srv_kw *kw;
switch (ctx->mode) {
+ case ADD_SRV_MODE_HELP:
+ if (!kwl) {
+ /* first invocation */
+ if (applet_putstr(appctx, "List of keywords supported for dynamic server:\n") < 0)
+ return cli_err(appctx, "output error");
+
+ kwl = LIST_NEXT(&srv_keywords.list, struct srv_kw_list *, list);
+ ctx->obj1 = kwl;
+ ctx->obj2 = kwl->kw;
+ }
+
+ while (kwl != &srv_keywords) {
+ for (kw = ctx->obj2; kw->kw; ++kw) {
+ if (!kw->dynamic_ok)
+ continue;
+
+ ctx->obj2 = kw;
+ chunk_reset(&trash);
+ chunk_printf(&trash, "%s\n", kw->kw);
+ if (applet_putchk(appctx, &trash) == -1)
+ goto full;
+ }
+
+ kwl = LIST_NEXT(&kwl->list, struct srv_kw_list *, list);
+ ctx->obj1 = kwl;
+ ctx->obj2 = kwl->kw;
+ }
+ break;
+
case ADD_SRV_MODE_DEF:
/* Add srv parser must return 1 to prevent I/O handler execution in default mode. */
ABORT_NOW();
}
return 1;
+
+ full:
+ return 0;
}
/* Parse a "add server" command.
++args;
+ if (strcmp(args[1], "help") == 0) {
+ ctx->mode = ADD_SRV_MODE_HELP;
+ ctx->obj2 = ctx->obj1 = NULL;
+ return 0;
+ }
+
ctx->mode = ADD_SRV_MODE_DEF;
sv_name = be_name = args[1];
/* split backend/server arg */