Class: Service::Proxy::ServiceConfig
- Inherits:
-
Object
- Object
- Service::Proxy::ServiceConfig
- Defined in:
- lib/service/proxy/service_config.rb
Instance Method Summary collapse
- #backend ⇒ Object
- #backend_path_for(original_path) ⇒ Object
-
#initialize(name, options) ⇒ ServiceConfig
constructor
A new instance of ServiceConfig.
- #path ⇒ Object
- #path_regexp ⇒ Object
- #read_timeout ⇒ Object
- #send_cookies? ⇒ Boolean
- #verify_ssl? ⇒ Boolean
Constructor Details
#initialize(name, options) ⇒ ServiceConfig
Returns a new instance of ServiceConfig.
4 5 6 7 |
# File 'lib/service/proxy/service_config.rb', line 4 def initialize(name, ) @name = name @options = end |
Instance Method Details
#backend ⇒ Object
9 10 11 |
# File 'lib/service/proxy/service_config.rb', line 9 def backend @backend ||= URI(@options.fetch(:backend, '')) end |
#backend_path_for(original_path) ⇒ Object
13 14 15 16 |
# File 'lib/service/proxy/service_config.rb', line 13 def backend_path_for(original_path) original_path.delete_prefix!(path) [backend.path, original_path].compact.join('/').gsub(/\/+/, '/') end |
#path ⇒ Object
18 19 20 |
# File 'lib/service/proxy/service_config.rb', line 18 def path @path ||= @options.fetch(:path) end |
#path_regexp ⇒ Object
22 23 24 |
# File 'lib/service/proxy/service_config.rb', line 22 def path_regexp @path_regexp ||= Regexp.new("^#{Regexp.escape(path)}") end |
#read_timeout ⇒ Object
34 35 36 |
# File 'lib/service/proxy/service_config.rb', line 34 def read_timeout @options.fetch(:read_timeout, nil) end |
#send_cookies? ⇒ Boolean
26 27 28 |
# File 'lib/service/proxy/service_config.rb', line 26 def @options.fetch(:forward_cookies, true) end |
#verify_ssl? ⇒ Boolean
30 31 32 |
# File 'lib/service/proxy/service_config.rb', line 30 def verify_ssl? @options.fetch(:verify_ssl, true) end |