Code Monkey home page Code Monkey logo

ex_ngrok's Introduction

Ngrok Elixir Library

Fork: This library was forked from https://github.com/joshuafleck/ex_ngrok

A wrapper around Ngrok providing a secure tunnel to localhost for demoing your Elixir/Phoenix web application or testing webhook integrations.

Once installed, ngrok will manage starting and stopping Ngrok with your application and expose Ngrok's settings to your application.

Dependencies

Installation

Add ngrok to your mix.exs dependencies...

def deps do
  [{:ngrok, "~> 1.0", only: [:dev]}]
end

Configuration

The default configurations may be overridden by setting any of the following in your config/config.exs file:

config :ngrok,
  # The name / path of the Ngrok executable
  executable: "ngrok"

Usage

Start Ngrok in your application / supervisor

Add the following code to your application / supervisor:

{Ngrok, port: 4000, name: MyApp.Ngrok}

The follwoing options are supported:

  • port (integer / required) - The port to tunnel.
  • protocol (atom / default: https) - The protocol to tunnel. (http / https / tcp / tls)
  • additional_arguments ([String.t()] / default: []) - Additional options to pass to ngrok.
  • name (Supervisor name / default: Ngrok) - Name of the supervisor in your application.
  • api_url (url / default: http://localhost:4040/api/tunnels) - The URL of Ngrok's API (used to retrieve its settings).
  • sleep_between_attempts (timeout (ms) / default: 200) - The amount of sleep (in ms) to put between attempts to connect to Ngrok

Retrieving your public URL

Ngrok will create a public URL that tunnels to your development machine. The URL will change every time Ngrok starts, but you can retrieve the URL by running the following:

Ngrok.public_url(MyApp.Ngrok) # => http://(.*).ngrok.io/

ex_ngrok's People

Contributors

maennchen avatar johns10 avatar pdawczak avatar joshuafleck avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.