Skip to content

Commit

Permalink
fix: correct check of environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGiulianelli committed Oct 28, 2024
1 parent 7d7d871 commit 023b3bf
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.eclipse.ditto.wodt.config;

import java.net.URI;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

/**
* The Configuration Loader implementation based on Environment Variables.
Expand All @@ -24,7 +24,7 @@ public class EnvironmentConfigurationLoader implements ConfigurationLoader{
* Default constructor.
*/
public EnvironmentConfigurationLoader() {
final boolean isAMandatoryVariableMissing = Stream.of(DITTO_URL_VARIABLE,
List.of(DITTO_URL_VARIABLE,
DITTO_OBSERVATION_ENDPOINT_VARIABLE,
DITTO_USERNAME_VARIABLE,
DITTO_PASSWORD_VARIABLE,
Expand All @@ -33,11 +33,11 @@ public EnvironmentConfigurationLoader() {
PA_ID_VARIABLE,
DT_URI_VARIABLE,
DT_EXPOSED_PORT_VARIABLE,
DT_VERSION_VARIABLE).anyMatch(variable -> System.getenv(variable) == null);

if (isAMandatoryVariableMissing) {
throw new IllegalStateException("Please specify all the mandatory environment variables");
}
DT_VERSION_VARIABLE).forEach(variable -> {
if (System.getenv(variable) == null) {
throw new IllegalStateException("Please specify the " + variable + " environment variable");
}
});
}

@Override
Expand Down

0 comments on commit 023b3bf

Please sign in to comment.