summaryrefslogtreecommitdiff
path: root/Types/StandardGroups.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2020-01-10 14:10:20 -0400
committerJoey Hess <joeyh@joeyh.name>2020-01-10 14:52:48 -0400
commit71ecfbfccf1f1d1dd3d83d79f80b694398e1092b (patch)
tree02dc973fcf4bf989138cea1bd70569c7e1431343 /Types/StandardGroups.hs
parentea3f206fd110e4063e8f1cbe3b330085ab631ce2 (diff)
be stricter about rejecting invalid configurations for remotes
This is a first step toward that goal, using the ProposedAccepted type in RemoteConfig lets initremote/enableremote reject bad parameters that were passed in a remote's configuration, while avoiding enableremote rejecting bad parameters that have already been stored in remote.log This does not eliminate every place where a remote config is parsed and a default value is used if the parse false. But, I did fix several things that expected foo=yes/no and so confusingly accepted foo=true but treated it like foo=no. There are still some fields that are parsed with yesNo but not not checked when initializing a remote, and there are other fields that are parsed in other ways and not checked when initializing a remote. This also lays groundwork for rejecting unknown/typoed config keys.
Diffstat (limited to 'Types/StandardGroups.hs')
-rw-r--r--Types/StandardGroups.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Types/StandardGroups.hs b/Types/StandardGroups.hs
index 5f00903570..bc19ff1a27 100644
--- a/Types/StandardGroups.hs
+++ b/Types/StandardGroups.hs
@@ -11,9 +11,9 @@ module Types.StandardGroups where
import Types.Remote (RemoteConfig)
import Types.Group
+import Types.ProposedAccepted
import qualified Data.Map as M
-import Data.Maybe
type PreferredContentExpression = String
@@ -71,7 +71,8 @@ associatedDirectory :: Maybe RemoteConfig -> StandardGroup -> Maybe FilePath
associatedDirectory _ SmallArchiveGroup = Just "archive"
associatedDirectory _ FullArchiveGroup = Just "archive"
associatedDirectory (Just c) PublicGroup = Just $
- fromMaybe "public" $ M.lookup "preferreddir" c
+ maybe "public" fromProposedAccepted $
+ M.lookup (Accepted "preferreddir") c
associatedDirectory Nothing PublicGroup = Just "public"
associatedDirectory _ _ = Nothing