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:
Joey Hess 2020-01-15 11:05:07 -04:00
parent 7f2bfd41d7
commit 907ca937ab
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 8 additions and 8 deletions

View file

@ -126,8 +126,8 @@ glacierSetup' ss u mcreds c gc = do
remotename = fromJust (lookupName c) remotename = fromJust (lookupName c)
defvault = remotename ++ "-" ++ fromUUID u defvault = remotename ++ "-" ++ fromUUID u
defaults = M.fromList defaults = M.fromList
[ (Proposed "datacenter", Proposed $ T.unpack $ AWS.defaultRegion AWS.Glacier) [ (datacenterField, Proposed $ T.unpack $ AWS.defaultRegion AWS.Glacier)
, (Proposed "vault", Proposed defvault) , (vaultField, Proposed defvault)
] ]
prepareStore :: Remote -> Preparer Storer prepareStore :: Remote -> Preparer Storer

View file

@ -215,10 +215,10 @@ s3Setup' ss u mcreds c gc
defbucket = remotename ++ "-" ++ fromUUID u defbucket = remotename ++ "-" ++ fromUUID u
defaults = M.fromList defaults = M.fromList
[ (datacenterField, Proposed $ T.unpack $ AWS.defaultRegion AWS.S3) [ (datacenterField, Proposed $ T.unpack $ AWS.defaultRegion AWS.S3)
, (Proposed "storageclass", Proposed "STANDARD") , (storageclassField, Proposed "STANDARD")
, (hostField, Proposed AWS.s3DefaultHost) , (hostField, Proposed AWS.s3DefaultHost)
, (Proposed "port", Proposed "80") , (portField, Proposed "80")
, (Proposed "bucket", Proposed defbucket) , (bucketField, Proposed defbucket)
] ]
use fullconfig pc info = do use fullconfig pc info = do
@ -251,10 +251,10 @@ s3Setup' ss u mcreds c gc
M.mapKeys (Proposed . replace "x-archive-" "x-amz-" . fromProposedAccepted) $ M.mapKeys (Proposed . replace "x-archive-" "x-amz-" . fromProposedAccepted) $
-- encryption does not make sense here -- encryption does not make sense here
M.insert encryptionField (Proposed "none") $ M.insert encryptionField (Proposed "none") $
M.insert (Accepted "bucket") (Proposed validbucket) $ M.insert bucketField (Proposed validbucket) $
M.union c' $ M.union c' $
-- special constraints on key names -- 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 pc <- either giveup return . parseRemoteConfig archiveconfig =<< configParser remote
info <- extractS3Info pc info <- extractS3Info pc
checkexportimportsafe pc info checkexportimportsafe pc info