Skip to content

Instantly share code, notes, and snippets.

@fotoflo
Last active October 29, 2016 07:09
Show Gist options
  • Save fotoflo/9ef6980b3ff484630f4e8f5e91281309 to your computer and use it in GitHub Desktop.
Save fotoflo/9ef6980b3ff484630f4e8f5e91281309 to your computer and use it in GitHub Desktop.
Ngrok is a great tool which creates introspectible tunnels, however its sometimes a pain to tell your app the name of its tunnel, so here we set it via javascript
var request = require('request-promise');
request('http://127.0.0.1:4040/api/tunnels')
.then( function(res){
var tunnels = JSON.parse(res).tunnels;
for(var i in tunnels){
console.log( 'setting NGROK_HOST_'+i+'=' + tunnels[i].public_url);
process.env['NGROK_HOST_'+i] = tunnels[i].public_url;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment