summaryrefslogtreecommitdiff
path: root/lib/leap/server.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/leap/server.rb')
-rw-r--r--lib/leap/server.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/leap/server.rb b/lib/leap/server.rb
index bc60455..05d76e3 100644
--- a/lib/leap/server.rb
+++ b/lib/leap/server.rb
@@ -2,10 +2,22 @@ require 'couchrest'
module LEAP
class Server < CouchRest::Server
+
def initialize
netrc = File.read('/root/.netrc').split(' ')
auth = "%{username}:%{password}@" % {username: netrc[3], password: netrc[5]}
super("http://#{auth}localhost:5984")
end
+
+ #
+ # returns an array of the names of all the per-user storage
+ # databases.
+ #
+ def storage_dbs
+ self.databases.select { |db_name|
+ db_name =~ /^user-[a-f0-9]{32}$/
+ }
+ end
+
end
end \ No newline at end of file