include credPairRemoteFields in RemoteConfigParsers
Avoids parse error when the fields are added to RemoteConfig at setup time and it then gets parsed, also at setup time. After setup time, such internally added fields are not a problem, because they're Accepted. So it may not be necessary in all cases to list such internally added fields, but I think it's a good idea to always do so.
This commit is contained in:
parent
0706d9d093
commit
7f2bfd41d7
4 changed files with 12 additions and 2 deletions
|
@ -40,6 +40,7 @@ remote = specialRemoteType $ RemoteType
|
|||
[ optionalStringParser datacenterField
|
||||
, optionalStringParser vaultField
|
||||
, optionalStringParser fileprefixField
|
||||
, optionalStringParser AWS.s3credsField
|
||||
]
|
||||
, setup = glacierSetup
|
||||
, exportSupported = exportUnsupported
|
||||
|
|
|
@ -13,6 +13,7 @@ module Remote.Helper.AWS where
|
|||
import Annex.Common
|
||||
import Creds
|
||||
import Types.ProposedAccepted
|
||||
import Types.RemoteConfig
|
||||
|
||||
import qualified Data.Map as M
|
||||
import qualified Data.ByteString as B
|
||||
|
@ -24,9 +25,12 @@ creds :: UUID -> CredPairStorage
|
|||
creds u = CredPairStorage
|
||||
{ credPairFile = fromUUID u
|
||||
, credPairEnvironment = ("AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY")
|
||||
, credPairRemoteField = Accepted "s3creds"
|
||||
, credPairRemoteField = s3credsField
|
||||
}
|
||||
|
||||
s3credsField :: RemoteConfigField
|
||||
s3credsField = Accepted "s3creds"
|
||||
|
||||
data Service = S3 | Glacier
|
||||
deriving (Eq)
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ remote = specialRemoteType $ RemoteType
|
|||
, optionalStringParser portField
|
||||
, optionalStringParser requeststyleField
|
||||
, optionalStringParser mungekeysField
|
||||
, optionalStringParser AWS.s3credsField
|
||||
]
|
||||
, remoteConfigRestPassthrough = \f ->
|
||||
isMetaHeader f || isArchiveMetaHeader f
|
||||
|
|
|
@ -49,6 +49,7 @@ remote = specialRemoteType $ RemoteType
|
|||
, generate = gen
|
||||
, configParser = mkRemoteConfigParser
|
||||
[ optionalStringParser urlField
|
||||
, optionalStringParser davcredsField
|
||||
]
|
||||
, setup = webdavSetup
|
||||
, exportSupported = exportIsSupported
|
||||
|
@ -58,6 +59,9 @@ remote = specialRemoteType $ RemoteType
|
|||
urlField :: RemoteConfigField
|
||||
urlField = Accepted "url"
|
||||
|
||||
davcredsField :: RemoteConfigField
|
||||
davcredsField = Accepted "davcreds"
|
||||
|
||||
gen :: Git.Repo -> UUID -> ParsedRemoteConfig -> RemoteGitConfig -> RemoteStateHandle -> Annex (Maybe Remote)
|
||||
gen r u c gc rs = new <$> remoteCost gc expensiveRemoteCost
|
||||
where
|
||||
|
@ -351,7 +355,7 @@ davCreds :: UUID -> CredPairStorage
|
|||
davCreds u = CredPairStorage
|
||||
{ credPairFile = fromUUID u
|
||||
, credPairEnvironment = ("WEBDAV_USERNAME", "WEBDAV_PASSWORD")
|
||||
, credPairRemoteField = Accepted "davcreds"
|
||||
, credPairRemoteField = davcredsField
|
||||
}
|
||||
|
||||
{- Content-Type to use for files uploaded to WebDAV. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue