MINOR: cfgparse: add support for program section

This patch is a part of series to reintroduce the program support in the new
master-worker architecture.

Programs are launched by master, thus only the master process needs its
configuration. Therefore, program section parser should be called only in
discovery mode, when master parses its configuration.

Program section has a post section parser. It should be called only in
discovery mode as well.
This commit is contained in:
Valentine Krasnobaeva 2024-10-09 23:11:07 +02:00 committed by Willy Tarreau
parent 45a284895a
commit a2fac5a3a1

View File

@ -2565,8 +2565,8 @@ int parse_cfg(const struct cfgfile *cfg)
if (pcs && pcs->post_section_parser) {
int status;
/* for the moment don't call post_section_parser in MODE_DISCOVERY */
if (global.mode & MODE_DISCOVERY)
/* don't call post_section_parser in MODE_DISCOVERY, except program section */
if ((global.mode & MODE_DISCOVERY) && (strcmp(pcs->section_name, "program") != 0))
continue;
status = pcs->post_section_parser();
@ -2589,8 +2589,9 @@ int parse_cfg(const struct cfgfile *cfg)
} else {
int status;
/* for the moment read only the "global" section in MODE_DISCOVERY */
if ((global.mode & MODE_DISCOVERY) && (strcmp(cs->section_name, "global") != 0))
/* read only the "global" and "program" sections in MODE_DISCOVERY */
if (((global.mode & MODE_DISCOVERY) && (strcmp(cs->section_name, "global") != 0)
&& (strcmp(cs->section_name, "program") != 0)))
continue;
status = cs->section_parser(file, linenum, args, kwm);