lib/stack-agent/configuration.rb in stack-agent-0.1.1 vs lib/stack-agent/configuration.rb in stack-agent-0.1.2
- old
+ new
@@ -27,10 +27,14 @@
Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address
end
def port
return Rails::Server.new.options[:Port] if defined?(Rails::Server)
- return ENV['PORT'] if ENV['PORT']
+ return ENV['PORT'] if (ENV['PORT'] && is_known_http_server?)
+ end
+
+ def is_known_http_server?
+ %w(puma unicorn thin rackup).include?(File.basename($0))
end
end
end