diff options
author | elijah <elijah@riseup.net> | 2015-09-29 14:22:15 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2015-09-29 14:22:15 -0700 |
commit | c6eeb0c9e5666e98f97b048882ad3668550f4741 (patch) | |
tree | d0225e7dd5064e563269340ddcece9c92b89cb51 /lib | |
parent | c577e3ec23de2ff8b8f8272b687351f62cfcf5ca (diff) |
added cleanup-user-dbs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap/server.rb | 12 | ||||
-rw-r--r-- | lib/leap/users.rb | 1 |
2 files changed, 13 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 diff --git a/lib/leap/users.rb b/lib/leap/users.rb index 14c9c4e..b9dc12c 100644 --- a/lib/leap/users.rb +++ b/lib/leap/users.rb @@ -30,6 +30,7 @@ module LEAP end def all_ids + self.all_docs["rows"].map {|row| row["id"]} end end |