serverless-ngrok-tunnel
Serverless plugin that creates ngrok public tunnel on localhost.
Optionally, writes tunnels url to .env file and deletes them after session is over. Useful for when you want to expose url for other applications to use (for example mobile application).
Installation
Add serverless-ngrok-tunnel to your project:
npm install --save-dev serverless-ngrok-tunnel
Then inside your serverless.yml
file add following entry to the plugins section:
plugins:
- serverless-ngrok-tunnel
Usage
First you will need to configure tunnels. In your serverless.yml
file add:
custom:
ngrokTunnel:
envPath: '../.env'
tunnels:
- port: 8000
envProp: 'API_GATEWAY'
- port: 1884
envProp: 'IOT_ENDPOINT'
ws: true
path: '/mqqt'
- port: 9000
ngrokOptions:
authtoken: '12345'
region: 'us'
subdomain: 'my-subdomain'
For a list of available ngrok options checkout ngrok documentation.
To start tunnel/s run sls tunnel
.
If you are using serverless-offline
plugin
- v2: start offline with option flag:
sls offline start --tunnel=true
. - v3: start offline with option flag:
sls offline start --param="tunnel=true"
.
Contributing
Yes, please. Checkout contributing guidelines.
Licence
MIT