diff options
Diffstat (limited to 'files/couch-doc-update')
-rw-r--r-- | files/couch-doc-update | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/files/couch-doc-update b/files/couch-doc-update index e4adfbe..3cdf6ce 100644 --- a/files/couch-doc-update +++ b/files/couch-doc-update @@ -35,7 +35,7 @@ def main # # parse options # - @host = "127.0.0.1:5984" + @host = nil @db_name = nil @doc_id = nil @new_data = nil @@ -102,12 +102,14 @@ def connection_string(database, host) netrc.scan(/\w+ [\w\.]+/).each do |key_value| key, value = key_value.split ' ' case key - when "machine" then host = value + ':' + port + when "machine" then host ||= value + ':' + port when "login" then username = value when "password" then password = value end end + host ||= '127.0.0.1:5984' + "%s://%s:%s@%s/%s" % [protocol, username, password, host, database] end |