Start localtunnel programmatically with rails s
If you're developing an app that uses third party services that need to send notifications to your app, you can easily provide access using localtunnel:
$ localtunnel 3000
But it's a pain to have to remember to run this command. Better yet, add the following to your config/application.rb
if Rails.env.development?
tunnel = LocalTunnel::Tunnel.new(3000, nil)
response = tunnel.register_tunnel
# Start localtunnel in a detached process.
Process.detach fork { tunnel.start_tunnel }
ENV['LOCALTUNNEL'] = response['host']
end
Written by Eric Holmes
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#