Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support gateway override via IPFS_GATEWAY ENV #29

Closed
lidel opened this issue Jun 5, 2023 · 3 comments
Closed

Support gateway override via IPFS_GATEWAY ENV #29

lidel opened this issue Jun 5, 2023 · 3 comments
Assignees

Comments

@lidel
Copy link
Collaborator

lidel commented Jun 5, 2023

Current list of trustless gateways is hardcoded in

std::vector<std::pair<std::string, int>> ipfs::Gateways::DefaultGateways() {
return {{"http://localhost:8080/"s, 906},
{"https://ipfs.io/"s, 902},
{"https://gateway.ipfs.io/"s, 901},
{"https://dweb.link/"s, 896},
{"https://jcsl.hopto.org/"s, 894},
{"https://ipfs.joaoleitao.org/"s, 858},
{"https://ipfs.jpu.jp/"s, 328},
{"https://jorropo.net/"s, 310},
{"https://gateway.pinata.cloud/"s, 293},
{"https://ipfs.runfission.com/"s, 256},
{"https://nftstorage.link/"s, 195},
{"https://w3s.link/"s, 135},
{"https://ipfs.scalaproject.io/"s, 69},
{"https://ipfs.soul-network.com/"s, 63},
{"https://ipfs.fleek.co/"s, 61},
{"https://permaweb.eu.org/"s, 51},
{"https://storry.tv/"s, 41},
{"https://hardbin.com/"s, 31},
{"https://ipfs-gateway.cloud/"s, 20},
{"https://ipfs.storry.tv/"s, 9},
{"https://ipfs.anonymize.com/"s, 0}};

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
Copy link
Collaborator

I wonder if that env name makes it obvious that

  • it's plural
  • it's instead-of and not in-addition-to
    I'm guessing you chose it for compatibility with other tool(s)?

@lidel
Copy link
Collaborator Author

lidel commented Jun 26, 2023

Yes, it is based on loose convention from ipfs/kubo#8847 and curl/curl#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 ipfs/specs#280 or separate IPIP).

@John-LittleBearLabs
Copy link
Collaborator

Merged into main under unrelated PR (sorry)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants