Class: Entrance::Agent::Config
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Entrance::Agent::Config
- Extended by:
- Globalizer
- Defined in:
- lib/entrance/agent/config.rb
Instance Attribute Summary
Attributes included from Globalizer
Instance Method Summary collapse
- #api_url ⇒ Object
- #config_file_path ⇒ Object
- #doorkeepr_server ⇒ Object
- #get_binding ⇒ Object
- #id ⇒ Object
- #id_files_prefix ⇒ Object
-
#initialize(params = {}) ⇒ Config
constructor
A new instance of Config.
- #pid_file_path ⇒ Object
- #socket_file_path ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Config
Returns a new instance of Config.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/entrance/agent/config.rb', line 14 def initialize params={} params[:path] ||= "/doorkeepr/entrance" params[:api_headers] ||= { "X-Doorkeepr-API" => 1, "Accept" => 'application/json', } params[:api_path] ||= "api" params[:api_timeout] ||= 5 params[:user_agent] ||= "Doorkeepr Watcher 1" params[:doorkeepr_server] ||= "http://localhost:3000" params[:doorkeepr_customer] ||= ENV["USER"] params[:doorkeepr_service] ||= "rails" params[:doorkeepr_url] ||= "/doorkeepr" params[:workdir] ||= Pathname.new("/tmp") params[:id_file] ||= params[:workdir].join("entrance.id").to_s params[:entrance] = nil params[:id] = nil params[:customer] ||= ENV["CUSTOMER"] || "global" params[:stats_user] ||= "haproxy" params[:stats_pass] ||= "secret" params[:http_port] ||= 80 params[:https_port] ||= 443 params[:health_url] ||= "/health" super params end |
Instance Method Details
#api_url ⇒ Object
61 62 63 |
# File 'lib/entrance/agent/config.rb', line 61 def api_url doorkeepr_server.join(api_path) end |
#config_file_path ⇒ Object
45 46 47 |
# File 'lib/entrance/agent/config.rb', line 45 def config_file_path id_files_prefix + "cfg" end |
#doorkeepr_server ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/entrance/agent/config.rb', line 54 def doorkeepr_server Pathname.new begin Boutons.doorkeepr.to_s rescue Boutons::SynapseNotFound @table[:doorkeepr_server] end end |
#get_binding ⇒ Object
64 65 66 |
# File 'lib/entrance/agent/config.rb', line 64 def get_binding binding end |
#id ⇒ Object
39 40 41 |
# File 'lib/entrance/agent/config.rb', line 39 def id entrance.id end |
#id_files_prefix ⇒ Object
42 43 44 |
# File 'lib/entrance/agent/config.rb', line 42 def id_files_prefix workdir.join("entrance-#{id}").to_s + "." end |
#pid_file_path ⇒ Object
51 52 53 |
# File 'lib/entrance/agent/config.rb', line 51 def pid_file_path id_files_prefix + "pid" end |
#socket_file_path ⇒ Object
48 49 50 |
# File 'lib/entrance/agent/config.rb', line 48 def socket_file_path id_files_prefix + "sock" end |