Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Remove unneeded class variable #359

Merged
merged 1 commit into from
May 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,18 @@
@Slf4j
public abstract class SdkUtils {

private static String serverIp = "localhost";

private SdkUtils() {
}

/**
* Creates and configures the APIClient using the configuration properties available
* in `sdk-config.yml`
* in environment variables.
* @return the ApiClient
*/
public static ApiClient getParodosAPiClient()
throws ApiException, MissingRequiredPropertiesException, InterruptedException {
ApiClient apiClient = Configuration.getDefaultApiClient();
serverIp = Optional.ofNullable(System.getenv("SERVER_IP")).orElse("localhost");
String serverIp = Optional.ofNullable(System.getenv("SERVER_IP")).orElse("localhost");
String serverPort = Optional.ofNullable(System.getenv("SERVER_PORT")).orElse("8080");

if (Strings.isNullOrEmpty(serverIp) || Strings.isNullOrEmpty(serverPort)) {
Expand All @@ -63,7 +61,7 @@ public static ApiClient getParodosAPiClient()
throw new IllegalArgumentException("serverPort must be > 0 && <= 65535");
}

String basePath = "http://" + serverIp + ":" + serverPort;
String basePath = "http://%s:%s".formatted(serverIp, serverPort);
log.info("serverIp is: {}, serverPort is {}. Set BasePath to {}", serverIp, serverPort, basePath);

apiClient.setBasePath(basePath);
Expand Down Expand Up @@ -361,8 +359,4 @@ public static ProjectResponseDTO getProjectAsync(ApiClient apiClient, String pro
return testProject;
}

public static String getServerIp() {
return serverIp;
}

}