[Trunk | Monitor Service]:

1. pom.xml: 
        a. Added timestamp in properties.
        b. In <build> added <resources> with filtering set to true.
2. GlobalVars.java: Added GlobalVars class for date of deploy & date of build.
3. UoaMonitorServiceApplication.java: 
        a. Added @PropertySource("classpath:admintoolslibrary.properties") and @PropertySource("classpath:notification.properties")
        b. In @EnableConfigurationProperties added GlobalVars.class.
4. MonitorServiceCheckDeployController.java: Added exposing date of deploy and date of build.
5. monitorservice.properties: Added property monitorservice.globalVars.buildDate=@timestamp@
This commit is contained in:
Konstantina Galouni 2021-09-15 22:17:52 +00:00
parent 7d4273bea4
commit 9b18159e2f
6 changed files with 46 additions and 4 deletions

View File

@ -28,6 +28,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>E MMM dd HH:mm:ss z yyyy</maven.build.timestamp.format>
</properties>
<dependencies>
@ -112,5 +114,11 @@
</plugin>
</plugins>
<finalName>uoa-monitor-service</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -1,6 +1,7 @@
package eu.dnetlib.uoamonitorservice;
import eu.dnetlib.uoaauthorizationlibrary.configuration.AuthorizationConfiguration;
import eu.dnetlib.uoamonitorservice.configuration.GlobalVars;
import eu.dnetlib.uoamonitorservice.configuration.properties.MongoConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -14,17 +15,18 @@ import org.springframework.context.annotation.PropertySources;
})
@PropertySources({
@PropertySource("classpath:authorization.properties"),
@PropertySource("classpath:admintoolslibrary.properties"),
@PropertySource("classpath:notification.properties"),
@PropertySource("classpath:monitorservice.properties"),
@PropertySource(value = "classpath:dnet-override.properties", ignoreResourceNotFound = true)
})
//SecurityConfig.class,
@EnableConfigurationProperties({ MongoConfig.class})
@EnableConfigurationProperties({ MongoConfig.class, GlobalVars.class})
@Import(AuthorizationConfiguration.class)
public class UoaMonitorServiceApplication {
public static void main(String[] args) {
SpringApplication.run(UoaMonitorServiceApplication.class, args);
}
}

View File

@ -0,0 +1,22 @@
package eu.dnetlib.uoamonitorservice.configuration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.Date;
@ConfigurationProperties("monitorservice.globalVars")
public class GlobalVars {
public static Date date = new Date();
private Date buildDate;
public String getBuildDate() {
if(buildDate == null) {
return null;
}
return buildDate.toString();
}
public void setBuildDate(Date buildDate) {
this.buildDate = buildDate;
}
}

View File

@ -3,6 +3,7 @@ package eu.dnetlib.uoamonitorservice.controllers;
import com.mongodb.BasicDBObject;
import com.mongodb.CommandResult;
import com.mongodb.DBObject;
import eu.dnetlib.uoamonitorservice.configuration.GlobalVars;
import eu.dnetlib.uoamonitorservice.configuration.mongo.MongoConnection;
import eu.dnetlib.uoamonitorservice.configuration.properties.MongoConfig;
import org.apache.log4j.Logger;
@ -29,6 +30,9 @@ public class MonitorServiceCheckDeployController {
@Autowired
private MongoConfig mongoConfig;
@Autowired
private GlobalVars globalVars;
@RequestMapping(value = {"", "/health_check"}, method = RequestMethod.GET)
public String hello() {
log.debug("Hello from uoa-monitor-service!");
@ -56,7 +60,12 @@ public class MonitorServiceCheckDeployController {
response.put("monitorservice.mongodb.password", mongoConfig.getPassword() == null ? null : "[unexposed value]");
// response.put("Define also", "monitorservice.mongodb.username, monitorservice.mongodb.password");
response.put("Date of build", new Date().toString());
if(globalVars.date != null) {
response.put("Date of deploy", globalVars.date.toString());
}
if(globalVars.getBuildDate() != null) {
response.put("Date of build", globalVars.getBuildDate());
}
return response;
}

View File

@ -8,6 +8,7 @@ monitorservice.password = ...
monitorservice.mongodb.host=localhost
monitorservice.mongodb.port=27017
monitorservice.mongodb.database=openaire_monitor3
monitorservice.globalVars.buildDate=@timestamp@
#beta
#monitorservice.userInfoUrl = https://beta.services.openaire.eu/uoa-user-management/api/users/getUserInfo?accessToken=

View File

@ -309,7 +309,7 @@ use monitordb;
//
// uniqueIndexes();
// 04-06-2021
// 04-06-2021 - 24-06-2021
addHomePageInPortalType("funder");
addFooterDivIdForPortalType("funder");
addFooterHelpTextForPortalType("funder");