@@ -32,8 +32,6 @@ int main(int argc, char **argv)
32
32
.setArgument ()
33
33
.setHelp (" listen on this port (default: 6080)" )
34
34
.setDefaultValue (" 6080" );
35
- parser.addOption (" http" )
36
- .setHelp (" enable http server" );
37
35
parser.addOption (" http-address" )
38
36
.setArgument ()
39
37
.setHelp (" http server listens on this address (default: 127.0.0.1)" )
@@ -57,7 +55,6 @@ int main(int argc, char **argv)
57
55
QString address = opts->option (" address" );
58
56
int port = opts->option (" port" ).toInt ();
59
57
60
- bool httpEnabled = opts->contains (" http" );
61
58
QString httpAddress = opts->option (" http-address" );
62
59
int httpPort = opts->option (" http-port" ).toInt ();
63
60
@@ -77,15 +74,14 @@ int main(int argc, char **argv)
77
74
listener.listen (QHostAddress (address), port);
78
75
qDebug () << " Simple server listening on" << address << " port" << port;
79
76
77
+ HttpRequestHandler handler (listener.index (), metrics);
78
+
80
79
QHttpServer httpListener (&app);
81
- if (httpEnabled) {
82
- HttpRequestHandler handler (listener.index (), metrics);
83
- httpListener.listen (QHostAddress (httpAddress), httpPort, [&](QHttpRequest *req, QHttpResponse *res) {
84
- handler.router ().handle (req, res);
85
- });
86
- qDebug () << " HTTP server listening on" << httpAddress << " port" << httpPort;
87
- qDebug () << " Prometheus metrics available at" << QString (" http://%1:%2/_metrics" ).arg (httpAddress).arg (httpPort);
88
- }
80
+ httpListener.listen (QHostAddress (httpAddress), httpPort, [&](QHttpRequest *req, QHttpResponse *res) {
81
+ handler.router ().handle (req, res);
82
+ });
83
+ qDebug () << " HTTP server listening on" << httpAddress << " port" << httpPort;
84
+ qDebug () << " Prometheus metrics available at" << QString (" http://%1:%2/_metrics" ).arg (httpAddress).arg (httpPort);
89
85
90
86
return app.exec ();
91
87
}
0 commit comments