fix metric saving for running in tests
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 2m10s

This commit is contained in:
Lee
2024-04-19 22:42:32 +01:00
parent 5871c64582
commit e5935c6696
5 changed files with 23 additions and 10 deletions

View File

@ -4,7 +4,7 @@ import lombok.Getter;
import lombok.experimental.UtilityClass;
@UtilityClass
public final class EnvironmentUtils {
public final class AppConfig {
/**
* Is the app running in a production environment?
*/
@ -14,4 +14,17 @@ public final class EnvironmentUtils {
String env = System.getenv("ENVIRONMENT");
production = env != null && (env.equals("production"));
}
/**
* Is the app running in a test environment?
*/
@Getter
private static boolean isRunningTest = true;
static {
try {
Class.forName("org.junit.Test");
} catch (ClassNotFoundException e) {
isRunningTest = false;
}
}
}