@@ -265,7 +265,7 @@ handleNodeWithTracers cmdPc nc p@(SomeConsensusProtocol blockType runP) = do
265265 then DisabledBlockForging
266266 else EnabledBlockForging ))
267267
268- handleSimpleNode blockType runP tracers nc networkMagic
268+ handleSimpleNode blockType runP tracers nc cmdPc networkMagic
269269 (\ nk -> do
270270 setNodeKernel nodeKernelData nk
271271 traceWith (nodeStateTracer tracers) NodeKernelOnline )
@@ -305,13 +305,16 @@ handleSimpleNode
305305 -> Api. ProtocolInfoArgs blk
306306 -> Tracers RemoteAddress LocalAddress blk IO
307307 -> NodeConfiguration
308+ -> PartialNodeConfiguration
309+ -- ^ Original CLI configuration, used for SIGHUP config reload so CLI
310+ -- overrides are preserved when re-reading the YAML file.
308311 -> NetworkMagic
309312 -> (NodeKernel IO RemoteAddress LocalConnectionId blk -> IO () )
310313 -- ^ Called on the 'NodeKernel' after creating it, but before the network
311314 -- layer is initialised. This implies this function must not block,
312315 -- otherwise the node won't actually start.
313316 -> IO ()
314- handleSimpleNode blockType runP tracers nc networkMagic onKernel = do
317+ handleSimpleNode blockType runP tracers nc cmdPc networkMagic onKernel = do
315318 logStartupWarnings
316319
317320 logDeprecatedLedgerDBOptions
@@ -439,7 +442,7 @@ handleSimpleNode blockType runP tracers nc networkMagic onKernel = do
439442 (readTVar ledgerPeerSnapshotPathVar)
440443 (readTVar useLedgerVar)
441444 (writeTVar ledgerPeerSnapshotVar)
442- updateRpcConfiguration (startupTracer tracers) (ncConfigFile nc) rpcConfigVar
445+ updateRpcConfiguration (startupTracer tracers) cmdPc rpcConfigVar
443446 traceWith (startupTracer tracers) (BlockForgingUpdate NotEffective )
444447 )
445448 Nothing
@@ -484,7 +487,7 @@ handleSimpleNode blockType runP tracers nc networkMagic onKernel = do
484487 rnNodeKernelHook = \ registry nodeKernel -> do
485488 -- reinstall `SIGHUP` handler
486489 installSigHUPHandler (startupTracer tracers) (Consensus. kesAgentTracer $ consensusTracers tracers)
487- blockType nc networkMagic nodeKernel localRootsVar publicRootsVar useLedgerVar
490+ blockType nc cmdPc networkMagic nodeKernel localRootsVar publicRootsVar useLedgerVar
488491 useBootstrapVar ledgerPeerSnapshotPathVar ledgerPeerSnapshotVar
489492 rpcConfigVar
490493 rnNodeKernelHook nodeArgs registry nodeKernel
@@ -579,6 +582,7 @@ installSigHUPHandler :: Tracer IO (StartupTrace blk)
579582 -> Tracer IO KESAgentClientTrace
580583 -> Api. BlockType blk
581584 -> NodeConfiguration
585+ -> PartialNodeConfiguration -- ^ original CLI configuration
582586 -> NetworkMagic
583587 -> NodeKernel IO RemoteAddress (ConnectionId LocalAddress ) blk
584588 -> StrictTVar IO [(HotValency , WarmValency , Map RelayAccessPoint (LocalRootConfig PeerTrustable ))]
@@ -590,9 +594,9 @@ installSigHUPHandler :: Tracer IO (StartupTrace blk)
590594 -> StrictTVar IO RpcConfig
591595 -> IO ()
592596#ifndef UNIX
593- installSigHUPHandler _ _ _ _ _ _ _ _ _ _ _ _ _ = return ()
597+ installSigHUPHandler _ _ _ _ _ _ _ _ _ _ _ _ _ _ = return ()
594598#else
595- installSigHUPHandler startupTracer kesAgentTracer blockType nc networkMagic nodeKernel localRootsVar
599+ installSigHUPHandler startupTracer kesAgentTracer blockType nc cmdPc networkMagic nodeKernel localRootsVar
596600 publicRootsVar useLedgerVar useBootstrapPeersVar ledgerPeerSnapshotPathVar ledgerPeerSnapshotVar
597601 rpcConfigVar =
598602 void $ Signals. installHandler
@@ -609,7 +613,7 @@ installSigHUPHandler startupTracer kesAgentTracer blockType nc networkMagic node
609613 (readTVar ledgerPeerSnapshotPathVar)
610614 (readTVar useLedgerVar)
611615 (writeTVar ledgerPeerSnapshotVar)
612- updateRpcConfiguration startupTracer (ncConfigFile nc) rpcConfigVar
616+ updateRpcConfiguration startupTracer cmdPc rpcConfigVar
613617 )
614618 Nothing
615619#endif
@@ -786,21 +790,18 @@ rpcServerLoop startupTracer rpcTracer rpcConfigVar networkMagic = go
786790 atomically . modifyTVar rpcConfigVar $ \ config -> config{isEnabled = Identity False }
787791
788792#ifdef UNIX
789- -- | Reload RPC configuration from the configuration file
790- updateRpcConfiguration :: Tracer IO (StartupTrace blk ) -- ^ tracer tracing the configuration reload
791- -> ConfigYamlFilePath -- ^ node configuration file, to reload configuration from
793+ -- | Reload RPC configuration by re-reading the YAML config file and merging
794+ -- with CLI overrides, exactly like startup does via 'buildNodeConfiguration'.
795+ updateRpcConfiguration :: Tracer IO (StartupTrace blk ) -- ^ tracer for configuration reload events
796+ -> PartialNodeConfiguration -- ^ original CLI configuration, merged with re-read YAML on reload
792797 -> StrictTVar IO RpcConfig -- ^ TVar storing RPC configuration
793798 -> IO ()
794- updateRpcConfiguration tracer configFilePath rpcConfigVar = do
795- result <- fmap (join . first Exception. displayException)
796- . try @ Exception. SomeException
797- . fmap makeNodeConfiguration
798- . parseNodeConfigurationFP
799- $ Just configFilePath
799+ updateRpcConfiguration tracer cmdPc rpcConfigVar = do
800+ result <- try @ Exception. SomeException $ buildNodeConfiguration cmdPc
800801 case result of
801802 Left err ->
802803 -- reload failure, we don't do anything this time
803- traceWith tracer (RpcConfigUpdateError $ pack err)
804+ traceWith tracer (RpcConfigUpdateError $ pack ( Exception. displayException err) )
804805 Right NodeConfiguration {ncRpcConfig= newConfig} ->
805806 join . atomically $ do
806807 oldConfig <- readTVar rpcConfigVar
0 commit comments