little-bear-labs / ipfs-chromium

19 stars 1 forks source link

Support gateway override via `IPFS_GATEWAY` ENV #29

Closed lidel closed 1 year ago

lidel commented 1 year ago

Current list of trustless gateways is hardcoded in

https://github.com/little-bear-labs/ipfs-chromium/blob/0e8d229d7898f7d2bc032ab9cc14d60dfd7c369b/library/src/ipfs_client/gateways.cc#L68-L89

To make it easier to test against own gateway running on a different port, or dofferent public ones, we could check if IPFS_GATEWAY is present in ENV, and if so, use its value as whitespace-separated list of gateways to use instead of the hardcoded one.

John-LittleBearLabs commented 1 year ago

I wonder if that env name makes it obvious that

lidel commented 1 year ago

Yes, it is based on loose convention from https://github.com/ipfs/kubo/issues/8847 and https://github.com/curl/curl/pull/8805, where we went with IPFS_GATEWAY as most of the time a user will set this to their preferred (local/LAN) gateway, so when set, plural option will rarely be used. Not set in stone, but would keep it the same, hoping to standardize this at some point (in https://github.com/ipfs/specs/pull/280 or separate IPIP).

John-LittleBearLabs commented 1 year ago

Merged into main under unrelated PR (sorry)