filecoin-project / starling

Demo storage client for archival video data
Other
51 stars 7 forks source link

Use ~/.lotus/token and ~/.lotus/api by default, fallback to FULLNODE_API_INFO for Lotus endpoints #52

Closed hsanjuan closed 3 years ago

hsanjuan commented 3 years ago

I have not managed to get starling to work without defining LOTUS_AUTH_TOKEN and LOTUS_URL.

However, local installations of Lotus provide this information already in ~/.lotus/token and ~/.lotus/api. Additionally, Lotus itself recognize a FULLNODE_API_INFO=<optional_token>:<url> env variable which is used to customize the client to use a custom endpoint/token. It would be good if starling relied on these two things, since they are rather standard.

The only gotcha is that lotus uses multiaddresses so, while FULLNODE_API_INFO=ws://something.. works, it will be more common to see FULLNODE_API_INFO=/ip4/<ip>/tcp/1234/http. Same for ~/.lotus/api, it will be a multiaddress.

These can be handled with ease using https://github.com/multiformats/js-multiaddr.

alexandrumatei36 commented 3 years ago

I did not work on the initial implementation of Starling, so this is inherited from previous versions. Indeed, relying on the data already provided by the Lotus would would minimize the setup process. PR coming soon. Thanks!

hsanjuan commented 3 years ago

@alexandrumatei36 I have realized that it also should prime LOTUS_PATH over ~/.lotus when defined.