- java.lang.Object
-
- com.github.alexdlaird.ngrok.conf.JavaNgrokConfig
-
public class JavaNgrokConfig extends java.lang.Object
An object for managingjava-ngrok
's configuration to interact thengrok
binary.Basic Usage
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 withngrok
v2 and v3, but by default it will install v3. To install v2 instead, set the version withJavaNgrokConfig.Builder.withNgrokVersion(NgrokVersion)
andCreateTunnel.Builder.withNgrokVersion(NgrokVersion)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JavaNgrokConfig.Builder
Builder for aJavaNgrokConfig
, see docs for that class for example usage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getApiKey()
Angrok
API key.java.lang.String
getAuthToken()
Get thengrok
authtoken that will be passed to commands.java.nio.file.Path
getConfigPath()
Get the path to thengrok
config file.ConfigVersion
getConfigVersion()
Thengrok
config version.java.util.function.Function<NgrokLog,java.lang.Void>
getLogEventCallback()
Get the log event callback that will be invoked each timengrok
emits a log.int
getMaxLogs()
Get the maximum number ofngrok
logs to retain in the monitoring thread.java.nio.file.Path
getNgrokPath()
Get the path to thengrok
binary.NgrokVersion
getNgrokVersion()
Get the majorngrok
version to be used.Region
getRegion()
Get the region in whichngrok
will start.int
getStartupTimeout()
Get the max timeout, in seconds, to wait forngrok
to start.boolean
isKeepMonitoring()
Get whether thengrok
process will continue to be monitored after it finishes starting up.
-
-
-
Method Detail
-
getNgrokVersion
public NgrokVersion getNgrokVersion()
Get the majorngrok
version to be used.
-
getMaxLogs
public int getMaxLogs()
Get the maximum number ofngrok
logs to retain in the monitoring thread.
-
getStartupTimeout
public int getStartupTimeout()
Get the max timeout, in seconds, to wait forngrok
to start.
-
isKeepMonitoring
public boolean isKeepMonitoring()
Get whether thengrok
process will continue to be monitored after it finishes starting up.
-
getNgrokPath
public java.nio.file.Path getNgrokPath()
Get the path to thengrok
binary.
-
getConfigPath
public java.nio.file.Path getConfigPath()
Get the path to thengrok
config file.
-
getAuthToken
public java.lang.String getAuthToken()
Get thengrok
authtoken that will be passed to commands.
-
getRegion
public Region getRegion()
Get the region in whichngrok
will start.
-
getLogEventCallback
public java.util.function.Function<NgrokLog,java.lang.Void> getLogEventCallback()
Get the log event callback that will be invoked each timengrok
emits a log.
-
getApiKey
public java.lang.String getApiKey()
Angrok
API key.
-
getConfigVersion
public ConfigVersion getConfigVersion()
Thengrok
config version.
-
-