1
0
mirror of https://github.com/Icinga/icinga2.git synced 2025-04-07 20:25:08 +02:00

Icinga DB: make error message more helpful if API isn't set up

This commit is contained in:
Julian Brost 2022-06-17 14:37:57 +02:00
parent 4522522444
commit 6b4681ee9e

@ -292,7 +292,14 @@ void IcingaDB::InitEnvironmentId()
}
}
} else {
std::shared_ptr<X509> cert = GetX509Certificate(ApiListener::GetDefaultCaPath());
String caPath = ApiListener::GetDefaultCaPath();
if (!Utility::PathExists(caPath)) {
throw std::runtime_error("Cannot find the CA certificate at '" + caPath + "'. "
"Please ensure the ApiListener is enabled first using 'icinga2 api setup'.");
}
std::shared_ptr<X509> cert = GetX509Certificate(caPath);
unsigned int n;
unsigned char digest[EVP_MAX_MD_SIZE];