diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/main.c b/main.c index 7e37094..9e747c0 100644 --- a/main.c +++ b/main.c @@ -67,11 +67,13 @@ static const struct collector *collectors[] = { struct config { const char *port; + const char *host; bool print; }; const struct config default_config = { .port = "9100", + .host = 0, .print = false, }; @@ -95,7 +97,7 @@ int main(int argc, char *argv[]) { return 0; } - scrape_server *server = scrape_listen(cfg.port); + scrape_server *server = scrape_listen(cfg.host, cfg.port); if (!server) return 1; @@ -154,6 +156,11 @@ static bool initialize(int argc, char *argv[], struct config *cfg, struct collec goto next_arg; } + if (strncmp(argv[arg], "--host=", 7) == 0) { + cfg->host = &argv[arg][7]; + goto next_arg; + } + if (strncmp(argv[arg], "--stdout", 8) == 0) { cfg->print = true; goto next_arg; |