Skip to content

Commit

Permalink
Fix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Sep 1, 2024
1 parent 0333680 commit 6b2a94a
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions src/test/java/com/squidex/api/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,30 @@ public static ClientProvider getClient() {
return singleClient;
}

String appName = System.getenv("CONFIG__APP__NAME");
String clientId = System.getenv("CONFIG__CLIENT_ID");
String clientSecret = System.getenv("CONFIG__CLIENT_SECRET");
String environment = System.getenv("CONFIG__SERVER__URL");

if (appName == null) {
appName = "integration-tests";
}

if (clientId == null) {
clientId = "root";
}

if (clientSecret == null) {
clientSecret = "xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0=";
}

if (environment == null) {
environment = "https://localhost:5001";
}
String appName = getEnvOrDefault("CONFIG__APP__NAME", "integration-tests");
String clientId = getEnvOrDefault("CONFIG__CLIENT_ID", "root");
String clientSecret = getEnvOrDefault("CONFIG__CLIENT_SECRET", "xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0=");
String url = getEnvOrDefault("CONFIG__SERVER__URL", "https://localhost:5001");

SquidexClientBuilder builder = SquidexClient.builder()
.trustAllCerts(true)
.appName(appName)
.clientId(clientId)
.clientSecret(clientSecret)
.baseUrl(environment);
.url(url);

singleClient = new ClientProvider(builder, builder.build());

return singleClient;
}

private static String getEnvOrDefault(String key, String defaultValue) {
String result = System.getenv(key);
if (result == null || result.isEmpty()) {
result = defaultValue;
}

return result;
}
}

0 comments on commit 6b2a94a

Please sign in to comment.