-
Notifications
You must be signed in to change notification settings - Fork 9
Configure FIL address via ENV vars + show it in WebUI #14
Comments
ContextAs discussed with @bajtos and @patrickwoodhead on Slack, given Saturn L2 is currently loading the webui as an external dependency, sharing the FIL address config value (and any other future config values) will require us to have a standardized way to do so. DecisionHaving saturn-l2 expose an HTTP API seems like the sensible thing to do. There are, however, a few options in terms of API architecture that should be considered. After checking the IPFS webui sister project, it can be seen it's using ipfs-http-client, which is its own HTTP RPC API client library (correct me if I'm wrong). To make an informed decision, we should consider any foreseeable future data flows. For instance, will we only ever expose/fetch discrete values or will we need want to vizualize more complex data? Is streaming an use-case? Given this, here's a comparison of different approaches to expose an HTTP API to communicate with a browser frontend. I should note the general ideas behind this comparison came from here. RESTThe traditional solution which allows for a lot of flexibility in terms of implementation. It thrives in scenarios where API clients are unknown or where requirements are loose. Flexibility is useful on the short-term but it builds entropy over time. Given we control both ends of the contract (API client and server), a tighter integration could be beneficial in terms of enforcing expectations on both ends. GraphQLA declarative approach to empower clients to fetch their desired data fields without having the server-side implementation growing in terms of endpoint implementation complexity (as is the case with REST). It shines in product development use cases. There are a couple of scenarios in which this could be useful:
Additionally, it allows fetching complex relational data models in a single request. However, we don’t have a relational data model and from my current understanding, it doesn't seem one would make sense. gRPCIt combines Google's lessons and knowledge in efficient remote communication for building complex distributed systems. It uses protobufs out of the box, which are a wire-efficient serialization protocol that enforces a data contract on both ends. It supports HTTP/2 transparently out of the box. It also has a bunch of more distributed system-oriented features (namely retries and deadline enforcement). It supports streaming use cases. To run on a web browser, it requires https://github.com/grpc/grpc-web. This uses a modified protocol which doesn't use HTTP/2, but HTTP/1.1. This protocol change requires a conversion layer between regular grpc and grpc-web, which is probably overkill with our current use case. json-rpcA lightweight and simple RPC protocol meant to perform RPC calls using JSON. It is protocol agnostic meaning it can run over HTTP or WebSockets. Library support exists, but it doesn't seem to be widely used. However, it is used by Ethereum clients. This could be a way to have an RPC-like solution without the overhead associated with gRPC. ConsequencesDepending on the chosen solution, future use-cases might be more convoluted to implement. |
I suppose this can be closed 👍 (provided we're not including the integration with the https://github.com/filecoin-project/saturn-webui here) |
Done in #34 |
FIL_ADDRESS
./webui
to show the address.The text was updated successfully, but these errors were encountered: