comment out config behavoir since only used for prints

This commit is contained in:
2025-04-25 21:23:42 +01:00
parent 805514edfa
commit 73a470e201
3 changed files with 24 additions and 20 deletions

View File

@@ -33,6 +33,8 @@ import CLI
, spawnProcP2PRC , spawnProcP2PRC
) )
import System.Environment (lookupEnv)
-- | Lower level P2PRC Haskell api that exposes basic functionality necessary to joint the network. -- | Lower level P2PRC Haskell api that exposes basic functionality necessary to joint the network.
@@ -41,7 +43,7 @@ data P2PRCapi
= MkP2PRCapi = MkP2PRCapi
{ startServer :: IOEitherError ProcessHandle { startServer :: IOEitherError ProcessHandle
-- ^ Start server -- ^ Start server
, execInitConfig :: IOEitherError P2PRCConfig -- , execInitConfig :: IOEitherError P2PRCConfig
-- ^ Instantiate server configuration -- ^ Instantiate server configuration
, execListServers :: IOEitherError IPAddressTable , execListServers :: IOEitherError IPAddressTable
-- ^ List servers in network -- ^ List servers in network
@@ -113,27 +115,29 @@ p2prcAPI =
] ]
MkEmptyStdInput MkEmptyStdInput
, execInitConfig = do -- , execInitConfig = do
confInitRes <- execProcP2PRC [ MkOptAtomic "--dc" ] MkEmptyStdInput -- confInitRes <- execProcP2PRC [ MkOptAtomic "--dc" ] MkEmptyStdInput
case confInitRes of -- case confInitRes of
(Right _) -> do -- (Right _) -> do
-- TODO: get config file name dynamically -- maybeValue <- lookupEnv "P2PRC"
--
currDirectory <- getCurrentDirectory
-- TODO: change values before loading file -- -- TODO: get config file name dynamically
let fname = currDirectory ++ "/config.json" :: FilePath -- --
-- currDirectory <- getCurrentDirectory
-- -- TODO: change values before loading file
-- let fname = currDirectory ++ "/config.json" :: FilePath
-- TODO: read config check if file exists -- -- TODO: read config check if file exists
configContent <- readFile fname -- configContent <- readFile fname
pure $ eitherErrDecode configContent -- pure $ eitherErrDecode configContent
(Left err) -> pure $ Left err -- (Left err) -> pure $ Left err
} }
@@ -147,5 +151,5 @@ p2prcAPI =
execProcP2PRCParser = eitherExecProcessParser p2prcCmdName execProcP2PRCParser = eitherExecProcessParser p2prcCmdName
-- TODO: GHC question, why does it scope down instead staying generic -- TODO: GHC question, why does it scope down instead staying generic
execProcP2PRC = eitherExecProcess p2prcCmdName -- execProcP2PRC = eitherExecProcess p2prcCmdName

View File

@@ -116,5 +116,5 @@ eitherErrorDecode esa =
-- assumes the program is ran inside the haskell module in p2prc's repo -- assumes the program is ran inside the haskell module in p2prc's repo
-- assumes that last path segment is "haskell" and that p2prc binary's name is "p2p-rendering-computation" -- assumes that last path segment is "haskell" and that p2prc binary's name is "p2p-rendering-computation"
p2prcCmdName :: String p2prcCmdName :: String
p2prcCmdName = "p2p-rendering-computation" p2prcCmdName = "p2prc"

View File

@@ -95,7 +95,7 @@ runP2PRC
( MkP2PRCapi ( MkP2PRCapi
{ startServer = startServer { startServer = startServer
, execInitConfig = execInitConfig -- , execInitConfig = execInitConfig
, execListServers = execListServers , execListServers = execListServers
, execMapPort = execMapPort , execMapPort = execMapPort
} }
@@ -105,12 +105,12 @@ runP2PRC
let let
configValue <- execInitConfig -- configValue <- execInitConfig
-- TODO: get name of host server from config json -- TODO: get name of host server from config json
print configValue -- print configValue
putStrLn "\n\n\n" -- putStrLn "\n\n\n"
eitherStartProcessHandle <- startServer eitherStartProcessHandle <- startServer