[DEV] add email properties

This commit is contained in:
Edouard DUPIN 2024-01-17 20:19:10 +01:00
parent f394254f38
commit 808784889b
8 changed files with 53 additions and 25 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry including="**/*.java" kind="src" output="out/maven/classes" path="src"> <classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="out/maven/test-classes" path="test/src"> <classpathentry kind="src" output="target/test-classes" path="test/src">
<attributes> <attributes>
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
@ -18,7 +18,7 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="out/maven/test-classes" path="test/resources"> <classpathentry excluding="**" kind="src" output="target/test-classes" path="test/resources">
<attributes> <attributes>
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
@ -30,5 +30,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="out/maven/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

15
pom.xml
View File

@ -160,7 +160,18 @@
<version>5.10.1</version> <version>5.10.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.23.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<sourceDirectory>src</sourceDirectory> <sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test/src</testSourceDirectory> <testSourceDirectory>test/src</testSourceDirectory>
@ -241,7 +252,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version> <version>3.3.1</version>
<configuration> <configuration>
<configLocation>CheckStyle.xml</configLocation> <configLocation>CheckStyle.xml</configLocation>
<consoleOutput>true</consoleOutput> <consoleOutput>true</consoleOutput>
@ -253,7 +264,7 @@
<plugin> <plugin>
<groupId>net.revelc.code.formatter</groupId> <groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId> <artifactId>formatter-maven-plugin</artifactId>
<version>2.12.2</version> <version>2.23.0</version>
<configuration> <configuration>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<lineEnding>LF</lineEnding> <lineEnding>LF</lineEnding>

View File

@ -52,7 +52,7 @@ public class DBEntry implements Closeable {
try { try {
this.connection = DriverManager.getConnection(this.config.getUrl(true), this.config.getLogin(), this.config.getPassword()); this.connection = DriverManager.getConnection(this.config.getUrl(true), this.config.getLogin(), this.config.getPassword());
} catch (final SQLException ex) { } catch (final SQLException ex) {
throw new IOException("Connection db fail: " + ex.getMessage()); throw new IOException("Connection db fail: " + ex.getMessage() + " On URL: " + this.config.getUrl(true));
} }
} }
@ -61,7 +61,7 @@ public class DBEntry implements Closeable {
try { try {
this.connection = DriverManager.getConnection(this.config.getUrl(), this.config.getLogin(), this.config.getPassword()); this.connection = DriverManager.getConnection(this.config.getUrl(), this.config.getLogin(), this.config.getPassword());
} catch (final SQLException ex) { } catch (final SQLException ex) {
throw new IOException("Connection db fail: " + ex.getMessage()); throw new IOException("Connection db fail: " + ex.getMessage() + " On URL: " + this.config.getUrl(true));
} }
} }

View File

@ -14,6 +14,9 @@ public class ConfigBaseVariable {
static public String ssoAdress; static public String ssoAdress;
static public String ssoToken; static public String ssoToken;
static public String testMode; static public String testMode;
static public String eMailFrom;
static public String eMailLogin;
static public String eMailPassword;
// For test only // For test only
public static void clearAllValue() { public static void clearAllValue() {
@ -30,6 +33,9 @@ public class ConfigBaseVariable {
ssoAdress = System.getenv("SSO_ADDRESS"); ssoAdress = System.getenv("SSO_ADDRESS");
ssoToken = System.getenv("SSO_TOKEN"); ssoToken = System.getenv("SSO_TOKEN");
testMode = System.getenv("TEST_MODE"); testMode = System.getenv("TEST_MODE");
eMailFrom = System.getenv("EMAIL_FROM");
eMailLogin = System.getenv("EMAIL_LOGIN");
eMailPassword = System.getenv("EMAIL_PASSWORD");
} }
static { static {
@ -120,4 +126,15 @@ public class ConfigBaseVariable {
} }
return Boolean.parseBoolean(testMode); return Boolean.parseBoolean(testMode);
} }
public record EMailConfig(String from, String login, String password) {
};
public static EMailConfig getEMailConfig() {
if (eMailFrom == null || eMailLogin == null || eMailPassword == null) {
return null;
}
return new EMailConfig(eMailFrom, eMailLogin, eMailPassword);
}
} }

View File

@ -23,5 +23,5 @@ function __run() #(step, name, cmd)
fi fi
} }
__run "1/1" "Check JAVA code format" "mvn formatter:verify" __run "1/1" "Check JAVA code format" "mvn formatter:validate"