graphprotocol / graph-tooling

Monorepo for various tools used by subgraph developers.
https://thegraph.com/docs
Apache License 2.0
392 stars 209 forks source link

update NETWORK_SUBGRAPH_MAINNET & add `api-key` to CLI #1760

Closed DenisCarriere closed 5 days ago

DenisCarriere commented 2 weeks ago

fixes: https://github.com/graphprotocol/graph-tooling/issues/1753

CLI changes

Example

graph publish --subgraph-id 5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV --api-key <STUDIO API KEY>

Website changes

changeset-bot[bot] commented 2 weeks ago

⚠️ No Changeset found

Latest commit: 78a4a90b4d7a5bce52cde98728fa8999a54d2cad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

cloudflare-workers-and-pages[bot] commented 2 weeks ago

Deploying graph-tooling with  Cloudflare Pages  Cloudflare Pages

Latest commit: 78a4a90
Status: ✅  Deploy successful!
Preview URL: https://742f6fc5.graph-tooling.pages.dev
Branch Preview URL: https://fix-website.graph-tooling.pages.dev

View logs

YaroShkvorets commented 2 weeks ago

After looking into it I feel like the proper way would be to use graph auth to store the gateway API key. There already exists graph auth to store the deploy key for Studio. So introducing a separate flag just for publish seems wrong.

graph auth used to have --studio and --hosted flags. After removing Hosted service we removed both flags, so now it's only used to store Studio key

BTW in Studio it actually tells you to use --studio, which doesn't work:

image

I propose returning --studio flag to graph auth and also adding --gateway flag that would be used to store the gateway API key.

What do you think @alex-pakalniskis @0237h @DenisCarriere ?

0237h commented 2 weeks ago

Good point, I think it makes sense to have all API keys managed from a single command like auth.

0237h commented 6 days ago

I propose returning --studio flag to graph auth and also adding --gateway flag that would be used to store the gateway API key.

@YaroShkvorets I'm wondering, aren't those technically the same keys ? Is there a technical reason you need to use different keys or could users use the same for both and this is more of an option ?

@DenisCarriere qualifies the gateway key as just the studio API key and from what I understand it is also treated as such on the Explorer (see pic) screenshot_2024-11-20_11-57-33

YaroShkvorets commented 6 days ago

These are different keys. The key to publish subgraphs is sent to https://api.thegraph.com. It's assigned to you by the Studio and it's not used for anything else. The key to sent queries is sent to https://gateway.thegraph.com and you can manage/rotate it.

YaroShkvorets commented 6 days ago
  1. make --api-key required for graph publish when --subgraph-id is supplied
YaroShkvorets commented 5 days ago

Added version extraction from network subgraph for an existing subgraph to properly update metadata.