ClickHouse/base/common/getFQDNOrHostName.cpp
Ivan 38b2dec354
Arcadia (#9729)
* Move getFQDNOrHostName to base/common/
* Add argsToConfig to ya.make
* Add coverage.cpp to ya.make
  Also remove WITH_COVERAGE from config file
2020-03-18 21:54:27 +03:00

26 lines
427 B
C++

#include <Poco/Net/DNS.h>
#include <common/getFQDNOrHostName.h>
namespace
{
std::string getFQDNOrHostNameImpl()
{
try
{
return Poco::Net::DNS::thisHost().name();
}
catch (...)
{
return Poco::Net::DNS::hostName();
}
}
}
const std::string & getFQDNOrHostName()
{
static std::string result = getFQDNOrHostNameImpl();
return result;
}