[Trunk | Admin Tools Library]:
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. UoaAdminToolsLibraryApplication.java: In @EnableConfigurationProperties added GlobalVars.class. 4. AdminToolsLibraryCheckDeployController.java: Added exposing date of deploy and date of build. 5. admintoolslibrary.properties: Added property admintoolslibrary.globalVars.buildDate=@timestamp@.
This commit is contained in:
parent
ca3a327172
commit
a7b07ad7e0
8
pom.xml
8
pom.xml
|
@ -22,6 +22,8 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<timestampAdminToolsLibrary>${maven.build.timestamp}</timestampAdminToolsLibrary>
|
||||
<maven.build.timestamp.format>E MMM dd HH:mm:ss z yyyy</maven.build.timestamp.format>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -103,6 +105,12 @@
|
|||
<!--</plugin>-->
|
||||
</plugins>
|
||||
<finalName>uoa-admin-tools-library</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.configuration.GlobalVars;
|
||||
import eu.dnetlib.uoaauthorizationlibrary.configuration.AuthorizationConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
@ -8,6 +9,6 @@ import eu.dnetlib.uoaadmintoolslibrary.configuration.properties.MailConfig;
|
|||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@SpringBootApplication//(scanBasePackages = {"eu.dnetlib.uoaauthorizationlibrary"})
|
||||
@EnableConfigurationProperties({MailConfig.class, GoogleConfig.class})
|
||||
@EnableConfigurationProperties({MailConfig.class, GoogleConfig.class, GlobalVars.class})
|
||||
@Import(AuthorizationConfiguration.class)
|
||||
public class UoaAdminToolsLibraryApplication {}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.configuration;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ConfigurationProperties("admintoolslibrary.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;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.controllers;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.CommandResult;
|
||||
import com.mongodb.DBObject;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.configuration.GlobalVars;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.configuration.properties.GoogleConfig;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.configuration.properties.MailConfig;
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -26,6 +24,9 @@ public class AdminToolsLibraryCheckDeployController {
|
|||
@Autowired
|
||||
private GoogleConfig googleConfig;
|
||||
|
||||
@Autowired
|
||||
private GlobalVars globalVars;
|
||||
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
|
||||
@RequestMapping(value = {"", "/health_check"}, method = RequestMethod.GET)
|
||||
|
@ -46,6 +47,12 @@ public class AdminToolsLibraryCheckDeployController {
|
|||
response.put("admintoolslibrary.mail.password", mailConfig.getPassword() == null ? null : "[unexposed value]");
|
||||
response.put("admintoolslibrary.google.secret", googleConfig.getSecret() == null ? null : "[unexposed value]");
|
||||
|
||||
if(globalVars.date != null) {
|
||||
response.put("Date of deploy", globalVars.date.toString());
|
||||
}
|
||||
if(globalVars.getBuildDate() != null) {
|
||||
response.put("Date of build", globalVars.getBuildDate());
|
||||
}
|
||||
// response.put("Define also", "admintoolslibrary.mail.username, " +
|
||||
// "admintoolslibrary.mail.password, admintoolslibrary.google.secret");
|
||||
return response;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
admintoolslibrary.globalVars.buildDate=@timestampAdminToolsLibrary@
|
Loading…
Reference in New Issue