Skip to content
Permalink
Browse files

Set defaults for missing yaml configuration keys

  • Loading branch information
Jimbo4350 committed Jan 14, 2020
1 parent 2e89769 commit 28e5de557a9318b47f7cffbf4cfac1525b1adfb0
Showing with 12 additions and 10 deletions.
  1. +12 −10 cardano-config/src/Cardano/Config/Types.hs
@@ -45,6 +45,8 @@ import Ouroboros.Consensus.NodeId (NodeId(..))

import Cardano.Config.Topology
import Cardano.Config.Orphanage ()
import Cardano.Crypto (RequiresNetworkMagic(..))

--------------------------------------------------------------------------------
-- Cardano Environment
--------------------------------------------------------------------------------
@@ -164,20 +166,20 @@ data NodeConfiguration =
instance FromJSON NodeConfiguration where
parseJSON = withObject "NodeConfiguration" $ \v -> do
nId <- v .:? "NodeId"
ptcl <- v .: "Protocol"
ptcl <- v .: "Protocol" .!= RealPBFT
numCoreNode <- v .:? "NumCoreNodes"
rNetworkMagic <- v .: "RequiresNetworkMagic"
rNetworkMagic <- v .:? "RequiresNetworkMagic" .!= RequiresNoMagic
pbftSignatureThresh <- v .:? "PBftSignatureThreshold"
loggingSwitch <- v .: "TurnOnLogging"
vMode <- v .: "ViewMode"
logMetrics <- v .: "TurnOnLogMetrics"
loggingSwitch <- v .:? "TurnOnLogging" .!= True
vMode <- v .:? "ViewMode" .!= LiveView
logMetrics <- v .:? "TurnOnLogMetrics" .!= True

-- Update Parameters
appName <- v .: "ApplicationName"
appVersion <- v .: "ApplicationVersion"
lkBlkVersionMajor <- v .: "LastKnownBlockVersion-Major"
lkBlkVersionMinor <- v .: "LastKnownBlockVersion-Minor"
lkBlkVersionAlt <- v .: "LastKnownBlockVersion-Alt"
appName <- v .:? "ApplicationName" .!= Update.ApplicationName "cardano-sl"
appVersion <- v .:? "ApplicationVersion" .!= 1
lkBlkVersionMajor <- v .:? "LastKnownBlockVersion-Major" .!= 0
lkBlkVersionMinor <- v .:? "LastKnownBlockVersion-Minor" .!= 2
lkBlkVersionAlt <- v .:? "LastKnownBlockVersion-Alt" .!= 0

pure $ NodeConfiguration
ptcl

0 comments on commit 28e5de5

Please sign in to comment.
You can’t perform that action at this time.