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
)
import System.Environment (lookupEnv)
-- | Lower level P2PRC Haskell api that exposes basic functionality necessary to joint the network.
@@ -41,7 +43,7 @@ data P2PRCapi
= MkP2PRCapi
{ startServer :: IOEitherError ProcessHandle
-- ^ Start server
, execInitConfig :: IOEitherError P2PRCConfig
-- , execInitConfig :: IOEitherError P2PRCConfig
-- ^ Instantiate server configuration
, execListServers :: IOEitherError IPAddressTable
-- ^ List servers in network
@@ -113,27 +115,29 @@ p2prcAPI =
]
MkEmptyStdInput
, execInitConfig = do
-- , execInitConfig = do
confInitRes <- execProcP2PRC [ MkOptAtomic "--dc" ] MkEmptyStdInput
-- confInitRes <- execProcP2PRC [ MkOptAtomic "--dc" ] MkEmptyStdInput
case confInitRes of
(Right _) -> do
-- case confInitRes of
-- (Right _) -> do
-- TODO: get config file name dynamically
--
currDirectory <- getCurrentDirectory
-- maybeValue <- lookupEnv "P2PRC"
-- TODO: change values before loading file
let fname = currDirectory ++ "/config.json" :: FilePath
-- -- TODO: get config file name dynamically
-- --
-- currDirectory <- getCurrentDirectory
-- -- TODO: change values before loading file
-- let fname = currDirectory ++ "/config.json" :: FilePath
-- TODO: read config check if file exists
configContent <- readFile fname
-- -- TODO: read config check if file exists
-- 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
-- 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 that last path segment is "haskell" and that p2prc binary's name is "p2p-rendering-computation"
p2prcCmdName :: String
p2prcCmdName = "p2p-rendering-computation"
p2prcCmdName = "p2prc"

View File

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