]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: init: report the list of optionally available services
authorWilly Tarreau <w@1wt.eu>
Tue, 19 Mar 2019 07:08:10 +0000 (08:08 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 19 Mar 2019 07:08:10 +0000 (08:08 +0100)
It's never easy to guess what services are built in. We currently have
the prometheus exporter in contrib/ which is the only extension for now.
Let's enumerate all available ones just like we do for filterr and pollers.

include/proto/stream.h
src/haproxy.c
src/stream.c

index a8c29921425f994a545832f3f4ef967e4adf7730..71ca8497a7242e5dea55bd69c67e10063ec68bf8 100644 (file)
@@ -348,6 +348,7 @@ static void inline stream_init_srv_conn(struct stream *sess)
 }
 
 void service_keywords_register(struct action_kw_list *kw_list);
+void list_services(FILE *out);
 
 #endif /* _PROTO_STREAM_H */
 
index 28c72a58aee87256acda070d4c91b716d0fdcb04..6a5abcb35e87615534a4ca254d128ade5f92e1a1 100644 (file)
@@ -412,6 +412,8 @@ static void display_build_opts()
        putchar('\n');
        list_mux_proto(stdout);
        putchar('\n');
+       list_services(stdout);
+       putchar('\n');
        list_filters(stdout);
        putchar('\n');
 }
index b915e13c8322ba84747902394d1bb74ffa81e46e..af3e1177fc8b11a1054fbdd91514520775a95708 100644 (file)
@@ -2795,6 +2795,25 @@ void service_keywords_register(struct action_kw_list *kw_list)
        LIST_ADDQ(&service_keywords, &kw_list->list);
 }
 
+/* Lists the known services on <out> */
+void list_services(FILE *out)
+{
+       struct action_kw_list *kw_list;
+       int found = 0;
+       int i;
+
+       fprintf(out, "Available services :");
+       list_for_each_entry(kw_list, &service_keywords, list) {
+               for (i = 0; kw_list->kw[i].kw != NULL; i++) {
+                       if (!found)
+                               fputc('\n', out);
+                       found = 1;
+                       fprintf(out, "\t%s\n", kw_list->kw[i].kw);
+               }
+       }
+       if (!found)
+               fprintf(out, " none\n");
+}
 
 /* This function dumps a complete stream state onto the stream interface's
  * read buffer. The stream has to be set in strm. It returns 0 if the output