From e01c1ca75f2a65f96ec3d548ff091da1f9ba15e8 Mon Sep 17 00:00:00 2001 From: Kateryna Oblakevych Date: Fri, 7 Jun 2024 05:39:57 +0300 Subject: [PATCH 1/2] fix: read only system variables for properties --- src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java b/src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java index 897e8e24..b5758d39 100644 --- a/src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java +++ b/src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java @@ -236,7 +236,7 @@ static void setEnvOrPropertyIfExists(Consumer setter, Map setter, String envKey) { - String param = getDotenv().get(envKey); + String param = System.getenv(envKey); if (param != null) { setter.accept(param); } From 5aabbf8ce190e1b1b32326af53a3a08064ab16c7 Mon Sep 17 00:00:00 2001 From: Kateryna Oblakevych Date: Tue, 11 Jun 2024 15:29:21 +0300 Subject: [PATCH 2/2] update lib and ignore malformed --- src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java | 2 +- versions.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java b/src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java index b5758d39..01299a0b 100644 --- a/src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java +++ b/src/main/java/com/crowdin/cli/properties/PropertiesBuilder.java @@ -245,7 +245,7 @@ static void setEnvIfExists(Consumer setter, String envKey) { private static Dotenv getDotenv() { if (dotenv == null) { try { - dotenv = Dotenv.configure().ignoreIfMissing().load(); + dotenv = Dotenv.configure().ignoreIfMissing().ignoreIfMalformed().load(); } catch (IllegalStateException e) { if (e.getMessage() != null && e.getMessage().contains("Duplicate key")) { throw new ExitCodeExceptionMapper.ValidationException(RESOURCE_BUNDLE.getString("error.duplicate_environment_variable"), e); diff --git a/versions.properties b/versions.properties index 01da4e24..dd3174f0 100644 --- a/versions.properties +++ b/versions.properties @@ -31,7 +31,7 @@ version.junit.jupiter=5.10.2 version.javax.activation..activation=1.1.1 -version.io.github.cdimascio..dotenv-java=2.3.2 +version.io.github.cdimascio..dotenv-java=3.0.0 version.info.picocli..picocli-codegen=4.7.6