Set Up Proxies

The Data Client Library allows to configure a proxy server for connecting to the Open Location Platform. You can configure proxies either programmatically or in the properties file.

Programmatic Configuration

When you create a ReadEngine, WriteEngine, or any Api object from DataClient, you can pass a custom Settings object that specifies your proxy configuration:

To configure your proxy programmatically, add the following:

Scala
Java
val dataClient = DataClient()

val proxySettings =
  ProxySettings(proxyHost, proxyPort, Some(ProxyCredentials(proxyLogin, proxyPass)))
val customSettings = dataClient.defaultSettings.withProxySettings(proxySettings)

dataClient.adminApi(settings = customSettings)
DataClient dataClient = DataClient.get(myActorSystem);

ProxyCredentials credentials = new ProxyCredentials(proxyLogin, proxyPass);
ProxySettings proxySettings =
    new ProxySettings.Builder()
        .withHost(proxyHost)
        .withPort(proxyPort)
        .withCredentials(credentials)
        .build();

Settings customSettings = dataClient.defaultSettings().withProxySettings(proxySettings);
dataClient.adminApi(customSettings);

Configuration in the Properties File

Use the following code snippet in your properties file to configure your proxy in the application configuration:

here.platform.data-client {
    proxy {
        host = "localhost"
        port = 9999
        credentials {
            username: "user"
            password: "pass"
        }
    }
}

For more details on configuration properties, see the Configuration section.

results matching ""

    No results matching ""