summaryrefslogtreecommitdiffhomepage
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-13 11:57:55 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-13 11:57:55 -0400
commitc8469290bde44a39863e64142ef40ea0fa040700 (patch)
tree372270ff07c56224a86a783e2a37460c16c07544 /CmdLine.hs
parent01c6543c27900764de2d68e65aebd51ea546bc88 (diff)
downloadkeysafe-c8469290bde44a39863e64142ef40ea0fa040700.tar.gz
adding some server disk usage tuning options
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs38
1 files changed, 27 insertions, 11 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index c3b8256..067d726 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -22,9 +22,9 @@ data CmdLine = CmdLine
, gui :: Bool
, testMode :: Bool
, customShareParams :: Maybe ShareParams
- , serverConfig :: ServerConfig
, name :: Maybe Name
, othername :: Maybe Name
+ , serverConfig :: ServerConfig
}
data Mode = Backup | Restore | UploadQueued | Server | Benchmark | Test
@@ -33,6 +33,8 @@ data Mode = Backup | Restore | UploadQueued | Server | Benchmark | Test
data ServerConfig = ServerConfig
{ serverPort :: Port
, serverAddress :: String
+ , diskReserveMb :: Int
+ , monthsToFillHalfDisk :: Int
}
parse :: Parser CmdLine
@@ -109,6 +111,16 @@ parse = CmdLine
<> metavar "N"
<> help ("Configure the number of shares needed to restore. (default: " ++ show (neededObjects (shareParams defaultTunables)) ++ ") (When this option is used to back up a key, it must also be provided at restore time.)")
)
+ nameopt = optional $ Name . BU8.fromString <$> strOption
+ ( long "name"
+ <> metavar "N"
+ <> help "Specify name used for key backup/restore, avoiding the usual prompt."
+ )
+ othernameopt = optional $ Name . BU8.fromString <$> strOption
+ ( long "othername"
+ <> metavar "N"
+ <> help "Specify other name used for key backup/restore, avoiding the usual prompt."
+ )
serverconfig = ServerConfig
<$> option auto
( long "port"
@@ -124,16 +136,20 @@ parse = CmdLine
<> showDefault
<> help "Address for server to bind to. (Use \"*\" to bind to all addresses.)"
)
- nameopt = optional $ Name . BU8.fromString <$> strOption
- ( long "name"
- <> metavar "N"
- <> help "Specify name used for key backup/restore, avoiding the usual prompt."
- )
- othernameopt = optional $ Name . BU8.fromString <$> strOption
- ( long "othername"
- <> metavar "N"
- <> help "Specify other name used for key backup/restore, avoiding the usual prompt."
- )
+ <*> option auto
+ ( long "disk-reserve"
+ <> metavar "N"
+ <> value 256
+ <> showDefault
+ <> help "Server refuses to store objects if less than this much disk space (in megabytes) is free"
+ )
+ <*> option auto
+ ( long "months-to-fill-half-disk"
+ <> metavar "N"
+ <> value 12
+ <> showDefault
+ <> help "Server rate-limits requests and requires proof of work, to avoid too many objects being stored. This is an lower bound on how long it could possibly take for half of the current disk space to be filled."
+ )
get :: IO CmdLine
get = execParser opts