mirror of https://github.com/voidlizard/hbs2
Refactoring
This commit is contained in:
parent
02be353096
commit
cadcfc38f1
|
@ -131,11 +131,13 @@ peerConfigRead mbfp = do
|
||||||
|
|
||||||
debug $ pretty cfgPath
|
debug $ pretty cfgPath
|
||||||
|
|
||||||
confData' <- liftIO $ readFile cfgPath <&> parseTop <&> either mempty id
|
let parseConf f = liftIO $ readFile f <&> parseTop <&> either mempty id
|
||||||
|
|
||||||
|
confData' <- parseConf cfgPath
|
||||||
|
|
||||||
knownPeersFiles <- mapM (liftIO . canonicalizePath . (dir </>)) (cfgValue @PeerKnownPeersFile $ PeerConfig confData')
|
knownPeersFiles <- mapM (liftIO . canonicalizePath . (dir </>)) (cfgValue @PeerKnownPeersFile $ PeerConfig confData')
|
||||||
|
|
||||||
knownPeersConfData <- concat <$> mapM (\file -> liftIO $ readFile file <&> parseTop <&> either mempty id) knownPeersFiles
|
knownPeersConfData <- concat <$> mapM parseConf knownPeersFiles
|
||||||
|
|
||||||
let confData = confData' <> either mempty id (parseTop peerConfDef) <> knownPeersConfData
|
let confData = confData' <> either mempty id (parseTop peerConfDef) <> knownPeersConfData
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,6 @@ instance HasCfgKey PeerBlackListKey (Set String) where
|
||||||
instance HasCfgKey PeerAcceptAnnounceKey AcceptAnnounce where
|
instance HasCfgKey PeerAcceptAnnounceKey AcceptAnnounce where
|
||||||
key = "accept-block-announce"
|
key = "accept-block-announce"
|
||||||
|
|
||||||
|
|
||||||
instance HasCfgValue PeerAcceptAnnounceKey AcceptAnnounce where
|
instance HasCfgValue PeerAcceptAnnounceKey AcceptAnnounce where
|
||||||
cfgValue (PeerConfig syn) = fromMaybe (AcceptAnnounceFrom lst) fromAll
|
cfgValue (PeerConfig syn) = fromMaybe (AcceptAnnounceFrom lst) fromAll
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in New Issue