MINOR: init: report the list of optionally available services
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.
diff --git a/include/proto/stream.h b/include/proto/stream.h
index a8c2992..71ca849 100644
--- a/include/proto/stream.h
+++ b/include/proto/stream.h
@@ -348,6 +348,7 @@
}
void service_keywords_register(struct action_kw_list *kw_list);
+void list_services(FILE *out);
#endif /* _PROTO_STREAM_H */
diff --git a/src/haproxy.c b/src/haproxy.c
index 28c72a5..6a5abcb 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -412,6 +412,8 @@
putchar('\n');
list_mux_proto(stdout);
putchar('\n');
+ list_services(stdout);
+ putchar('\n');
list_filters(stdout);
putchar('\n');
}
diff --git a/src/stream.c b/src/stream.c
index b915e13..af3e117 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2795,6 +2795,25 @@
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