Skip to content

Commit

Permalink
add proxy to config for httpclient calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Hodge committed Feb 25, 2014
1 parent d9e9e89 commit 475c675
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/neography/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class Config
:log_file, :log_enabled, :logger, :slow_log_threshold,
:max_threads,
:authentication, :username, :password,
:parser, :max_execution_time
:parser, :max_execution_time,
:proxy

def initialize
set_defaults
Expand All @@ -29,7 +30,8 @@ def to_hash
:username => @username,
:password => @password,
:parser => @parser,
:max_execution_time => @max_execution_time
:max_execution_time => @max_execution_time,
:proxy => @proxy
}
end

Expand All @@ -51,6 +53,7 @@ def set_defaults
@password = nil
@parser = MultiJsonParser
@max_execution_time = 6000
@proxy = nil
end

end
Expand Down
6 changes: 4 additions & 2 deletions lib/neography/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ class Connection
:log_file, :log_enabled, :logger, :slow_log_threshold,
:max_threads,
:authentication, :username, :password,
:parser, :client
:parser, :client,
:proxy

def initialize(options = ENV['NEO4J_URL'] || {})
config = merge_configuration(options)
save_local_configuration(config)
@client = HTTPClient.new
@client = HTTPClient.new(config[:proxy])
@client.send_timeout = 1200 # 10 minutes
@client.receive_timeout = 1200
authenticate
Expand Down Expand Up @@ -101,6 +102,7 @@ def save_local_configuration(config)
@max_threads = config[:max_threads]
@parser = config[:parser]
@logger = config[:logger]
@proxy = config[:proxy]

@max_execution_time = { 'max-execution-time' => config[:max_execution_time] }
@user_agent = { "User-Agent" => USER_AGENT }
Expand Down

0 comments on commit 475c675

Please sign in to comment.