mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 21:13:44 +02:00
put /metrics endpoint behind auth
This commit is contained in:
parent
5657406fd4
commit
e9503474a4
1 changed files with 9 additions and 9 deletions
|
@ -1673,7 +1673,15 @@ public:
|
||||||
|
|
||||||
} else scode = 404;
|
} else scode = 404;
|
||||||
_node->freeQueryResult((void *)pl);
|
_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 {
|
} else {
|
||||||
if (_controller) {
|
if (_controller) {
|
||||||
scode = _controller->handleControlPlaneHttpGET(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType);
|
scode = _controller->handleControlPlaneHttpGET(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType);
|
||||||
|
@ -1751,14 +1759,6 @@ public:
|
||||||
scode = 404;
|
scode = 404;
|
||||||
}
|
}
|
||||||
#endif
|
#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 {
|
} else {
|
||||||
scode = 401; // isAuth == false && !sso
|
scode = 401; // isAuth == false && !sso
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue