From 24bc6de3748685a3719bcd5729f20bce85f0ee26 Mon Sep 17 00:00:00 2001 From: Igor I Date: Thu, 19 Dec 2024 17:37:35 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=B4=D0=B0=D1=82=D1=83=20?= =?UTF-8?q?=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kz_istransit_jwt.properties | 1 + pom.xml | 10 +++++++ .../java/org/ccalm/jwt/MainController.java | 27 ++++++++++++++++--- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/kz_istransit_jwt.properties b/kz_istransit_jwt.properties index 530bfd3..8e1b996 100644 --- a/kz_istransit_jwt.properties +++ b/kz_istransit_jwt.properties @@ -2,6 +2,7 @@ spring.application.name=kz_istransit_jwt server.port=8082 issuer.name=istransit + logging.level.com.zaxxer.hikari=DEBUG spring.datasource.url=jdbc:postgresql://10.101.1.6:5432/transit_2024_09_03?ApplicationName=kz_istransit_jwt diff --git a/pom.xml b/pom.xml index dfcce3d..2eabc5f 100644 --- a/pom.xml +++ b/pom.xml @@ -111,6 +111,7 @@ googleauth 1.5.0 + @@ -118,7 +119,15 @@ org.springframework.boot spring-boot-maven-plugin + + + + build-info + + + + org.apache.maven.plugins maven-surefire-plugin @@ -129,6 +138,7 @@ + diff --git a/src/main/java/org/ccalm/jwt/MainController.java b/src/main/java/org/ccalm/jwt/MainController.java index 26f7347..8806992 100644 --- a/src/main/java/org/ccalm/jwt/MainController.java +++ b/src/main/java/org/ccalm/jwt/MainController.java @@ -59,7 +59,12 @@ import java.time.Duration; import java.time.Instant; import java.util.*; import java.util.List; +import java.util.jar.Attributes; +import java.util.jar.JarFile; import java.util.regex.Pattern; +import java.io.InputStream; +import java.util.Properties; +import java.io.IOException; @Controller public class MainController implements ServletContextAware { @@ -262,10 +267,26 @@ public class MainController implements ServletContextAware { public String index(Model model,@RequestParam(required=false,name="lng",defaultValue = "1") String language_id) { JSONObject json = new JSONObject(); json.put("error_code",0); - json.put("error_message","Application name: "+application_name); + json.put("error_message",""); json.put("error_marker",(String)null); - json.put("active_connections",dataSource.getHikariPoolMXBean().getActiveConnections()); - json.put("idle_connections",dataSource.getHikariPoolMXBean().getIdleConnections()); + String buildDate=""; + //String buildVersion=""; + try { + InputStream inputStream = MainController.class.getClassLoader().getResourceAsStream("META-INF/build-info.properties"); + if (inputStream != null) { + Properties properties = new Properties(); + properties.load(inputStream); + buildDate = properties.getProperty("build.time"); + //buildVersion = properties.getProperty("build.version"); + } + } catch (Exception e) { + e.printStackTrace(); + } + json.put("build_date",buildDate); + //json.put("build_version",buildVersion); + json.put("name",application_name); + //json.put("active_connections",dataSource.getHikariPoolMXBean().getActiveConnections()); + //json.put("idle_connections",dataSource.getHikariPoolMXBean().getIdleConnections()); return json.toString(); } /*