put /metrics endpoint behind auth

This commit is contained in:
Grant Limberg 2023-04-21 09:27:32 -07:00
parent 5657406fd4
commit e9503474a4
No known key found for this signature in database
GPG key ID: 8F2F97D3BE8D7735

View file

@ -1673,7 +1673,15 @@ public:
} else scode = 404;
_node->freeQueryResult((void *)pl);
} else scode = 500;
} else scode = 500;\
} else if (ps[0] == "metrics") {
std::string statspath = _homePath + ZT_PATH_SEPARATOR + "metrics.prom";
if (!OSUtils::readFile(statspath.c_str(), responseBody)) {
scode = 500;
} else {
scode = 200;
responseContentType = "text/plain";
}
} else {
if (_controller) {
scode = _controller->handleControlPlaneHttpGET(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType);
@ -1751,14 +1759,6 @@ public:
scode = 404;
}
#endif
} else if (ps[0] == "metrics") {
std::string statspath = _homePath + ZT_PATH_SEPARATOR + "metrics.prom";
if (!OSUtils::readFile(statspath.c_str(), responseBody)) {
scode = 500;
} else {
scode = 200;
responseContentType = "text/plain";
}
} else {
scode = 401; // isAuth == false && !sso
}