Class: AgileProxy::Config
- Inherits:
-
Object
- Object
- AgileProxy::Config
- Defined in:
- lib/agile_proxy/config.rb
Overview
Configuration for the agile proxy
Constant Summary collapse
- DEFAULT_WHITELIST =
['127.0.0.1', 'localhost']
- RANDOM_AVAILABLE_PORT =
0
Instance Attribute Summary collapse
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#cache_path ⇒ Object
Returns the value of attribute cache_path.
-
#cache_request_headers ⇒ Object
Returns the value of attribute cache_request_headers.
-
#database_config_file ⇒ Object
Returns the value of attribute database_config_file.
-
#dynamic_jsonp ⇒ Object
Returns the value of attribute dynamic_jsonp.
-
#dynamic_jsonp_keys ⇒ Object
Returns the value of attribute dynamic_jsonp_keys.
-
#enable_cache ⇒ Object
Returns the value of attribute enable_cache.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#ignore_cache_port ⇒ Object
Returns the value of attribute ignore_cache_port.
-
#ignore_params ⇒ Object
Returns the value of attribute ignore_params.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#non_successful_cache_disabled ⇒ Object
Returns the value of attribute non_successful_cache_disabled.
-
#non_successful_error_level ⇒ Object
Returns the value of attribute non_successful_error_level.
-
#non_whitelisted_requests_disabled ⇒ Object
Returns the value of attribute non_whitelisted_requests_disabled.
-
#path_blacklist ⇒ Object
Returns the value of attribute path_blacklist.
-
#persist_cache ⇒ Object
Returns the value of attribute persist_cache.
-
#proxied_request_connect_timeout ⇒ Object
Returns the value of attribute proxied_request_connect_timeout.
-
#proxied_request_inactivity_timeout ⇒ Object
Returns the value of attribute proxied_request_inactivity_timeout.
-
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
-
#server_host ⇒ Object
Returns the value of attribute server_host.
-
#server_port ⇒ Object
Returns the value of attribute server_port.
-
#webserver_host ⇒ Object
Returns the value of attribute webserver_host.
-
#webserver_port ⇒ Object
Returns the value of attribute webserver_port.
-
#whitelist ⇒ Object
Returns the value of attribute whitelist.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#reset ⇒ Object
Resets the configuration with the defaults.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
17 18 19 20 |
# File 'lib/agile_proxy/config.rb', line 17 def initialize @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) reset end |
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def cache @cache end |
#cache_path ⇒ Object
Returns the value of attribute cache_path.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def cache_path @cache_path end |
#cache_request_headers ⇒ Object
Returns the value of attribute cache_request_headers.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def cache_request_headers @cache_request_headers end |
#database_config_file ⇒ Object
Returns the value of attribute database_config_file.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def database_config_file @database_config_file end |
#dynamic_jsonp ⇒ Object
Returns the value of attribute dynamic_jsonp.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def dynamic_jsonp @dynamic_jsonp end |
#dynamic_jsonp_keys ⇒ Object
Returns the value of attribute dynamic_jsonp_keys.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def dynamic_jsonp_keys @dynamic_jsonp_keys end |
#enable_cache ⇒ Object
Returns the value of attribute enable_cache.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def enable_cache @enable_cache end |
#environment ⇒ Object
Returns the value of attribute environment.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def environment @environment end |
#ignore_cache_port ⇒ Object
Returns the value of attribute ignore_cache_port.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def ignore_cache_port @ignore_cache_port end |
#ignore_params ⇒ Object
Returns the value of attribute ignore_params.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def ignore_params @ignore_params end |
#logger ⇒ Object
Returns the value of attribute logger.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def logger @logger end |
#non_successful_cache_disabled ⇒ Object
Returns the value of attribute non_successful_cache_disabled.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def non_successful_cache_disabled @non_successful_cache_disabled end |
#non_successful_error_level ⇒ Object
Returns the value of attribute non_successful_error_level.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def non_successful_error_level @non_successful_error_level end |
#non_whitelisted_requests_disabled ⇒ Object
Returns the value of attribute non_whitelisted_requests_disabled.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def non_whitelisted_requests_disabled @non_whitelisted_requests_disabled end |
#path_blacklist ⇒ Object
Returns the value of attribute path_blacklist.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def path_blacklist @path_blacklist end |
#persist_cache ⇒ Object
Returns the value of attribute persist_cache.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def persist_cache @persist_cache end |
#proxied_request_connect_timeout ⇒ Object
Returns the value of attribute proxied_request_connect_timeout.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def proxied_request_connect_timeout @proxied_request_connect_timeout end |
#proxied_request_inactivity_timeout ⇒ Object
Returns the value of attribute proxied_request_inactivity_timeout.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def proxied_request_inactivity_timeout @proxied_request_inactivity_timeout end |
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def proxy_port @proxy_port end |
#server_host ⇒ Object
Returns the value of attribute server_host.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def server_host @server_host end |
#server_port ⇒ Object
Returns the value of attribute server_port.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def server_port @server_port end |
#webserver_host ⇒ Object
Returns the value of attribute webserver_host.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def webserver_host @webserver_host end |
#webserver_port ⇒ Object
Returns the value of attribute webserver_port.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def webserver_port @webserver_port end |
#whitelist ⇒ Object
Returns the value of attribute whitelist.
11 12 13 |
# File 'lib/agile_proxy/config.rb', line 11 def whitelist @whitelist end |
Instance Method Details
#reset ⇒ Object
Resets the configuration with the defaults
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/agile_proxy/config.rb', line 23 def reset @cache = true @cache_request_headers = false @whitelist = DEFAULT_WHITELIST @path_blacklist = [] @ignore_params = [] @persist_cache = false @dynamic_jsonp = false @dynamic_jsonp_keys = ['callback'] @ignore_cache_port = true @non_successful_cache_disabled = false @non_successful_error_level = :warn @non_whitelisted_requests_disabled = false @cache_path = File.join(Dir.tmpdir, 'agile-proxy') @proxy_port = RANDOM_AVAILABLE_PORT @proxied_request_inactivity_timeout = 10 # defaults from https://github.com/igrigorik/em-http-request/wiki/Redirects-and-Timeouts @proxied_request_connect_timeout = 5 @webserver_port = 3020 @webserver_host = 'localhost' @server_port = 3030 @server_host = 'localhost' @database_config_file = File.join(File.dirname(__FILE__), '..', '..', 'config.yml') @environment = ENV['AGILE_PROXY_ENV'] @enable_cache = false end |