Skip to content

Commit

Permalink
🔧 Add new configuration setting for the public API URL
Browse files Browse the repository at this point in the history
  • Loading branch information
agmangas committed Apr 16, 2024
1 parent 425cfd8 commit fbf1aa1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class OpenAPICoreExtension implements ServiceExtension {
private static final String DEFAULT_HTTP_SCHEME = "http";
private static final String PUBLIC_API_URL_KEY = "publicApiUrl";
private static final String DEFAULT_HOSTNAME = "localhost";
private static final String WEB_HTTP_PUBLIC_URL = "web.http.public.url";

/**
* The name of the extension.
Expand Down Expand Up @@ -118,13 +119,16 @@ private DataPlaneInstance buildDataPlaneInstance(ServiceExtensionContext context
String publicPort = context.getSetting(WEB_HTTP_PUBLIC_PORT, String.valueOf(DEFAULT_WEB_HTTP_PUBLIC_PORT));
String scheme = context.getSetting(HTTP_SCHEME, DEFAULT_HTTP_SCHEME);

String publicEndpoint = context.getSetting(WEB_HTTP_PUBLIC_URL,
String.format("%s://%s:%s/public/", scheme, hostname, publicPort));

DataPlaneInstance dataPlaneInstance = DataPlaneInstance.Builder.newInstance()
.id(DATA_PLANE_ID)
.url(String.format("%s://%s:%s/control/transfer", scheme, hostname, controlPort))
.allowedSourceType(HTTP_DATA_TYPE)
.allowedDestType(HTTP_DATA_TYPE)
.allowedDestType(TransferDataPlaneConstants.HTTP_PROXY)
.property(PUBLIC_API_URL_KEY, String.format("%s://%s:%s/public/", scheme, hostname, publicPort))
.property(PUBLIC_API_URL_KEY, publicEndpoint)
.build();

monitor.debug(String.format("Built data plane instance: %s", dataPlaneInstance.getProperties()));
Expand Down

0 comments on commit fbf1aa1

Please sign in to comment.