public class JavaNgrokConfig
extends java.lang.Object
java-ngrok
's configuration to interact the ngrok
binary.
final Function<NgrokLog, Void> logEventCallback = ngrokLog -> { System.out.println(ngrokLog.getLine()); return null; }; final JavaNgrokConfig javaNgrokConfig = new JavaNgrokConfig.Builder() .withAuthToken("<NGROK_AUTHTOKEN>") .withApiKey("<NGROK_API_KEY>") .withRegion(Region.AU) .withLogEventCallback(logEventCallback) .withMaxLogs(10); final NgrokClient ngrokClient = new NgrokClient.Builder() .withJavaNgrokConfig(javaNgrokConfig) .build();
ngrok
Version Compatibilityjava-ngrok
is compatible with ngrok
v2 and v3, but by default it will install v3. To
install v2 instead, set the version with
JavaNgrokConfig.Builder.withNgrokVersion(NgrokVersion)
and
CreateTunnel.Builder.withNgrokVersion(NgrokVersion)
.Modifier and Type | Class and Description |
---|---|
static class |
JavaNgrokConfig.Builder
Builder for a
JavaNgrokConfig , see docs for that class for example usage. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getApiKey()
A
ngrok API key. |
java.lang.String |
getAuthToken()
Get the
ngrok authtoken that will be passed to commands. |
java.nio.file.Path |
getConfigPath()
Get the path to the
ngrok config file. |
ConfigVersion |
getConfigVersion()
The
ngrok config version. |
java.util.function.Function<NgrokLog,java.lang.Void> |
getLogEventCallback()
Get the log event callback that will be invoked each time
ngrok emits a log. |
int |
getMaxLogs()
Get the maximum number of
ngrok logs to retain in the monitoring thread. |
java.nio.file.Path |
getNgrokPath()
Get the path to the
ngrok binary. |
NgrokVersion |
getNgrokVersion()
Get the major
ngrok version to be used. |
Region |
getRegion()
Get the region in which
ngrok will start. |
int |
getStartupTimeout()
Get the max timeout, in seconds, to wait for
ngrok to start. |
boolean |
isKeepMonitoring()
Get whether the
ngrok process will continue to be monitored after it finishes starting up. |
public NgrokVersion getNgrokVersion()
ngrok
version to be used.public int getMaxLogs()
ngrok
logs to retain in the monitoring thread.public int getStartupTimeout()
ngrok
to start.public boolean isKeepMonitoring()
ngrok
process will continue to be monitored after it finishes starting up.public java.nio.file.Path getNgrokPath()
ngrok
binary.public java.nio.file.Path getConfigPath()
ngrok
config file.public java.lang.String getAuthToken()
ngrok
authtoken that will be passed to commands.public Region getRegion()
ngrok
will start.public java.util.function.Function<NgrokLog,java.lang.Void> getLogEventCallback()
ngrok
emits a log.public java.lang.String getApiKey()
ngrok
API key.public ConfigVersion getConfigVersion()
ngrok
config version.