Last active
January 7, 2021 19:00
-
-
Save vaskaloidis/590b837a1f0cc9adf0bc20049a0ac1b5 to your computer and use it in GitHub Desktop.
ngrok
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Rails.const_defined? 'Server' | |
options = { addr: ENV.fetch('PORT') { 3000 } } | |
puts 'Starting Ngrok' | |
Ngrok::Tunnel.start(options) | |
puts '[NGROK] tunneling at ' + Ngrok::Tunnel.ngrok_url_https | |
config.hosts << Ngrok::Tunnel.ngrok_url_https | |
ENV['api_return_url_base'] = Ngrok::Tunnel.ngrok_url_https | |
puts "[Ngrok] ENV VARIABLE api_return_url_base: #{ENV["api_return_url_base"]}" | |
end | |
at_exit do | |
if Rails.const_defined? 'Server' | |
if Ngrok::Tunnel.running? | |
puts 'Stopping Ngrok' | |
Ngrok::Tunnel.stop | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment