summaryrefslogtreecommitdiff
path: root/lib/chef/search
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-12-18 19:14:33 -0800
committerClaire McQuin <claire@getchef.com>2014-12-18 19:14:33 -0800
commitc84f600dbd2ce5c55aa83f22ff78f149aecbbbd9 (patch)
tree11c699b0b74a531e79d44337803c062fb3e59ace /lib/chef/search
parentf08e31446bef0270510f12243858f37eb8e06797 (diff)
downloadchef-c84f600dbd2ce5c55aa83f22ff78f149aecbbbd9.tar.gz
Add optional config parameter.
Diffstat (limited to 'lib/chef/search')
-rw-r--r--lib/chef/search/query.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef/search/query.rb b/lib/chef/search/query.rb
index 23763ca59f..1d0e4ee122 100644
--- a/lib/chef/search/query.rb
+++ b/lib/chef/search/query.rb
@@ -27,10 +27,16 @@ class Chef
class Search
class Query
- attr_accessor :rest
+ attr_accessor :config, :rest
+ private :config
- def initialize(url=nil)
- @rest = Chef::REST.new(url || Chef::Config[:chef_server_url])
+ def initialize(url=nil, config:Chef::Config)
+ @config = config
+ @url = url
+ end
+
+ def rest
+ @rest ||= Chef::REST.new(@url || @config[:chef_server_url])
end
# Backwards compatability for cookbooks.