RPC Server #103

Merged
pitmutt merged 129 commits from rav001 into milestone3 2024-11-21 15:30:22 +00:00
2 changed files with 5 additions and 5 deletions
Showing only changes of commit 8ba1dfa7c7 - Show all commits

View file

@ -19,5 +19,5 @@ main = do
nodePort <- require config "nodePort"
let myConfig = Config dbFilePath zebraHost zebraPort nodeUser nodePwd nodePort
let ctx = authenticate myConfig :. EmptyContext
run 8081 $
run nodePort $
serveWithContext (Proxy :: Proxy ZenithRPC) ctx (zenithServer myConfig)

View file

@ -25,9 +25,9 @@ import Zenith.Types
)
type ZenithRPC
= "status" :> Get '[ JSON] Value :<|> ReqBody '[ JSON] RpcCall :> Post
= "status" :> Get '[ JSON] Value :<|> BasicAuth "zenith-realm" Bool :> ReqBody
'[ JSON]
(RpcResponse Value)
RpcCall :> Post '[ JSON] (RpcResponse Value)
zenithServer :: Config -> Server ZenithRPC
zenithServer config = getinfo :<|> handleRPC
@ -39,8 +39,8 @@ zenithServer config = getinfo :<|> handleRPC
[ "version" .= ("0.7.0.0-beta" :: String)
, "network" .= ("testnet" :: String)
]
handleRPC :: RpcCall -> Handler (RpcResponse Value)
handleRPC req =
handleRPC :: Bool -> RpcCall -> Handler (RpcResponse Value)
handleRPC isAuth req =
case method req of
UnknownMethod ->
return $