Class NgrokInstaller

    • Field Detail

      • UNIX_BINARIES

        public static final java.util.List<java.lang.String> UNIX_BINARIES
      • DEFAULT_NGROK_PATH

        public static final java.nio.file.Path DEFAULT_NGROK_PATH
      • DEFAULT_CONFIG_PATH

        public static final java.nio.file.Path DEFAULT_CONFIG_PATH
    • Constructor Detail

      • NgrokInstaller

        public NgrokInstaller()
      • NgrokInstaller

        public NgrokInstaller​(HttpClient httpClient)
    • Method Detail

      • getNgrokBin

        public static java.lang.String getNgrokBin()
        Get the ngrok executable for the current system.
        Returns:
        The name of the ngrok executable.
      • installDefaultConfig

        public void installDefaultConfig​(java.nio.file.Path configPath,
                                         java.util.Map<java.lang.String,​java.lang.Object> data,
                                         NgrokVersion ngrokVersion)
        Install the default ngrok config. If a config is not already present for the given path, create one.
        Parameters:
        configPath - The path to where the ngrok config should be installed.
        data - A map of things to add to the default config.
      • installNgrok

        public void installNgrok​(java.nio.file.Path ngrokPath,
                                 NgrokVersion ngrokVersion)
        Download and install the latest ngrok for the current system, overwriting any existing contents at the given path.
        Parameters:
        ngrokPath - The path to where the ngrok binary will be downloaded.
        ngrokVersion - The major ngrok version to install.
      • getNgrokCDNUrl

        public NgrokCDNUrl getNgrokCDNUrl​(NgrokVersion ngrokVersion)
        Determine the ngrok CDN URL for the current OS and architecture.
        Parameters:
        ngrokVersion - The major version of ngrok to install.
        Returns:
        The ngrok CDN URL.
      • validateConfig

        public void validateConfig​(java.nio.file.Path configPath)
        Validate that the config file at the given path is valid for ngrok and java-ngrok.
        Parameters:
        configPath - The config path to validate.
      • validateConfig

        public void validateConfig​(java.util.Map<java.lang.String,​java.lang.Object> data)
        Validate that the given map of config items are valid for ngrok and java-ngrok.
        Parameters:
        data - A map of things to be validated as config items.
      • getSystem

        public static java.lang.String getSystem()
        Parse the name fo the OS from system properties and return a friendly name.
        Returns:
        The friendly name of the OS.
      • getNgrokConfig

        public java.util.Map<java.lang.String,​java.lang.Object> getNgrokConfig​(java.nio.file.Path configPath,
                                                                                     boolean useCache,
                                                                                     NgrokVersion ngrokVersion)
        Get the ngrok config from the given path.
        Parameters:
        configPath - The ngrok config path to read.
        useCache - Use the cached version of the config (if populated).
        Returns:
        A map of the ngrok config.
      • getDefaultConfig

        public java.util.Map<java.lang.String,​java.lang.Object> getDefaultConfig​(NgrokVersion ngrokVersion)
        Get the default config params for the given major version of ngrok.
        Parameters:
        ngrokVersion - The major version of ngrok installed.
        Returns:
        The default config.