From 26d048d6c3871f9745603dd291522513e49f9129 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 9 Aug 2016 08:44:53 +0200 Subject: [PATCH] Add version info in /v1 fixes #12327 --- lib/remote/infohandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/remote/infohandler.cpp b/lib/remote/infohandler.cpp index 04c0c90f4..868dcbf54 100644 --- a/lib/remote/infohandler.cpp +++ b/lib/remote/infohandler.cpp @@ -19,6 +19,7 @@ #include "remote/infohandler.hpp" #include "remote/httputility.hpp" +#include "base/application.hpp" using namespace icinga; @@ -70,6 +71,7 @@ bool InfoHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request, result1->Set("user", user->GetName()); result1->Set("permissions", Array::FromVector(permInfo)); + result1->Set("version", Application::GetAppVersion()); result1->Set("info", "More information about API requests is available in the documentation at http://docs.icinga.org/icinga2/latest."); Array::Ptr results = new Array(); @@ -82,7 +84,7 @@ bool InfoHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request, } else { response.AddHeader("Content-Type", "text/html"); - String body = "Icinga 2

Hello from Icinga 2!

"; + String body = "Icinga 2

Hello from Icinga 2 (Version: " + Application::GetAppVersion() + ")!

"; body += "

You are authenticated as " + user->GetName() + ". "; if (!permInfo.empty()) {