Sha256: f85720c956b8a5f7c11ac6be269383bd26ad10d3d09519f7563b84b6ead3d218
Contents?: true
Size: 834 Bytes
Versions: 1
Compression:
Stored size: 834 Bytes
Contents
require 'socket' module StackAgent class Configuration DEFAULT_API_HOST = 'https://stackotron-discover.herokuapp.com' attr_accessor :api_host attr_accessor :app_token attr_accessor :name attr_accessor :group attr_accessor :uri def initialize @api_host = DEFAULT_API_HOST @name = Socket.gethostname # If we're running inside rails, attempt to fill in a bunch of the blanks if defined?(Rails) && Rails.env.development? @group = 'Development' @uri = "http://#{ip}:#{port}" if port end end private def ip 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'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stack-agent-0.1.1 | lib/stack-agent/configuration.rb |