use more field functions
Using field functions consistently avoids possibility of typos and also helps ensure that all fields are added to RemoteConfigParsers (as long as I have remembered to add them when writing the functions).
This commit is contained in:
parent
7f2bfd41d7
commit
907ca937ab
2 changed files with 8 additions and 8 deletions
|
@ -126,8 +126,8 @@ glacierSetup' ss u mcreds c gc = do
|
|||
remotename = fromJust (lookupName c)
|
||||
defvault = remotename ++ "-" ++ fromUUID u
|
||||
defaults = M.fromList
|
||||
[ (Proposed "datacenter", Proposed $ T.unpack $ AWS.defaultRegion AWS.Glacier)
|
||||
, (Proposed "vault", Proposed defvault)
|
||||
[ (datacenterField, Proposed $ T.unpack $ AWS.defaultRegion AWS.Glacier)
|
||||
, (vaultField, Proposed defvault)
|
||||
]
|
||||
|
||||
prepareStore :: Remote -> Preparer Storer
|
||||
|
|
10
Remote/S3.hs
10
Remote/S3.hs
|
@ -215,10 +215,10 @@ s3Setup' ss u mcreds c gc
|
|||
defbucket = remotename ++ "-" ++ fromUUID u
|
||||
defaults = M.fromList
|
||||
[ (datacenterField, Proposed $ T.unpack $ AWS.defaultRegion AWS.S3)
|
||||
, (Proposed "storageclass", Proposed "STANDARD")
|
||||
, (storageclassField, Proposed "STANDARD")
|
||||
, (hostField, Proposed AWS.s3DefaultHost)
|
||||
, (Proposed "port", Proposed "80")
|
||||
, (Proposed "bucket", Proposed defbucket)
|
||||
, (portField, Proposed "80")
|
||||
, (bucketField, Proposed defbucket)
|
||||
]
|
||||
|
||||
use fullconfig pc info = do
|
||||
|
@ -251,10 +251,10 @@ s3Setup' ss u mcreds c gc
|
|||
M.mapKeys (Proposed . replace "x-archive-" "x-amz-" . fromProposedAccepted) $
|
||||
-- encryption does not make sense here
|
||||
M.insert encryptionField (Proposed "none") $
|
||||
M.insert (Accepted "bucket") (Proposed validbucket) $
|
||||
M.insert bucketField (Proposed validbucket) $
|
||||
M.union c' $
|
||||
-- special constraints on key names
|
||||
M.insert (Proposed "mungekeys") (Proposed "ia") defaults
|
||||
M.insert mungekeysField (Proposed "ia") defaults
|
||||
pc <- either giveup return . parseRemoteConfig archiveconfig =<< configParser remote
|
||||
info <- extractS3Info pc
|
||||
checkexportimportsafe pc info
|
||||
|
|
Loading…
Reference in a new issue