summaryrefslogtreecommitdiffhomepage
path: root/Storage
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-15 22:49:38 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-15 22:49:38 -0400
commit845fb2d60585be5567ac10aa0a53ab45c628648c (patch)
treee58456868911cd16451f4695ff7d076a701a78bb /Storage
parent4fc681f78b2e659d3db3da99fe7c640416fb3b43 (diff)
downloadkeysafe-845fb2d60585be5567ac10aa0a53ab45c628648c.tar.gz
Added --backup-server and --restore-server
To aid in backing up keysafe servers with minimal information leakage. This commit was sponsored by Andrea Rota.
Diffstat (limited to 'Storage')
-rw-r--r--Storage/Local.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Storage/Local.hs b/Storage/Local.hs
index 6a952fa..90da7b8 100644
--- a/Storage/Local.hs
+++ b/Storage/Local.hs
@@ -6,6 +6,7 @@
module Storage.Local
( localStorage
, storageDir
+ , storageTopDir
, testStorageDir
, localDiskUsage
) where
@@ -147,13 +148,14 @@ storageDir Nothing (Section section) = do
storageDir (Just (LocalStorageDirectory d)) (Section section) =
pure $ d </> section
+storageTopDir :: Maybe LocalStorageDirectory -> IO FilePath
+storageTopDir lsd = storageDir lsd (Section ".")
+
testStorageDir :: FilePath -> GetShareDir
testStorageDir tmpdir = storageDir (Just (LocalStorageDirectory tmpdir))
localDiskUsage :: Maybe LocalStorageDirectory -> IO DiskUsage
-localDiskUsage lsd = do
- dir <- storageDir lsd (Section ".")
- getDiskUsage dir
+localDiskUsage lsd = getDiskUsage =<< storageTopDir lsd
-- | The takeFileName ensures that, if the StorableObjectIdent somehow
-- contains a path (eg starts with "../" or "/"), it is not allowed