-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.ru
More file actions
executable file
·31 lines (26 loc) · 1002 Bytes
/
config.ru
File metadata and controls
executable file
·31 lines (26 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This file is used by Rack-based servers to start the application.
require_relative 'config/environment'
run Rails.application
def require_ngrok
require 'ngrok/tunnel'
options = {
addr: 3001,
region: 'eu'
}
if File.file? '.ngrok'
options[:config] = '.ngrok'
elsif File.file? ENV['HOME'] + '/.ngrok'
options[:config] = ENV['HOME'] + '/.ngrok'
end
options[:inspect] = ENV['NGROK_INSPECT'] if ENV['NGROK_INSPECT']
puts '[NGROK] tunneling at ' + Ngrok::Tunnel.start(options)
puts '[NGROK] tunneling at ' + Ngrok::Tunnel.ngrok_url_https
# Directly set on Heroku for staging/prod
Rails.application.secrets[:hubspot][:redirect_path] = Ngrok::Tunnel.ngrok_url_https + Rails.application.secrets.dig(:hubspot, :redirect_path)
unless ENV['NGROK_INSPECT'] == 'false'
puts '[NGROK] inspector web interface listening at http://127.0.0.1:4040'
end
rescue Ngrok::FetchUrlError => e
p e
end
require_ngrok unless %w[production staging].include?(ENV['RAILS_ENV'])