Add version in jar

- Cli argument
- In HTTP client
- /version endpoint
This commit is contained in:
Max Dor
2019-02-16 03:06:46 +01:00
parent aadfae2965
commit 4d63bba251
6 changed files with 86 additions and 9 deletions

View File

@@ -26,7 +26,7 @@ import io.undertow.server.HttpServerExchange;
public class StatusHandler extends BasicHttpHandler {
public static final String Path = "/_matrix/identity/status";
public static final String Path = "/status";
@Override
public void handleRequest(HttpServerExchange exchange) {

View File

@@ -0,0 +1,48 @@
/*
* mxisd - Matrix Identity Server Daemon
* Copyright (C) 2019 Kamax Sarl
*
* https://www.kamax.io/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.kamax.mxisd.http.undertow.handler.status;
import com.google.gson.JsonObject;
import io.kamax.matrix.json.GsonUtil;
import io.kamax.mxisd.Mxisd;
import io.kamax.mxisd.http.undertow.handler.BasicHttpHandler;
import io.undertow.server.HttpServerExchange;
public class VersionHandler extends BasicHttpHandler {
public static final String Path = "/version";
private final String body;
public VersionHandler() {
JsonObject server = new JsonObject();
server.addProperty("name", "mxisd");
server.addProperty("version", Mxisd.Version);
body = GsonUtil.getPrettyForLog(GsonUtil.makeObj("server", server));
}
@Override
public void handleRequest(HttpServerExchange exchange) {
respondJson(exchange, body);
}
}