summaryrefslogtreecommitdiff
path: root/lib/tapicero/config.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tapicero/config.rb')
-rw-r--r--lib/tapicero/config.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/tapicero/config.rb b/lib/tapicero/config.rb
index f760cca..6e0fdfe 100644
--- a/lib/tapicero/config.rb
+++ b/lib/tapicero/config.rb
@@ -15,11 +15,15 @@ module Tapicero
end
end
- # TODO: enable username and password
- def couch_host
- couch_connection[:protocol] + '://' +
- couch_connection[:host] + ':' +
- couch_connection[:port].to_s + '/'
+ def couch_host(conf = nil)
+ conf ||= couch_connection
+ userinfo = [conf[:username], conf[:password]].compact.join(':')
+ userinfo += '@' unless userinfo.empty?
+ "#{conf[:protocol]}://#{userinfo}#{conf[:host]}:#{conf[:port]}"
+ end
+
+ def couch_host_without_password
+ couch_host couch_connection.merge({:password => nil})
end
private