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

update NETWORK_SUBGRAPH_MAINNET & add api-key to CLI #1760

Merged
merged 5 commits into from
Nov 21, 2024
Merged

Conversation

DenisCarriere
Copy link
Contributor

@DenisCarriere DenisCarriere commented Nov 6, 2024

fixes: #1753

CLI changes

  • add --api-key: The API key to use for the Subgraph queries.

Example

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

Website changes

Copy link

changeset-bot bot commented Nov 6, 2024

⚠️ No Changeset found

Latest commit: 78a4a90

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

Copy link

cloudflare-workers-and-pages bot commented Nov 6, 2024

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

@0237h 0237h requested a review from YaroShkvorets November 7, 2024 17:22
@YaroShkvorets
Copy link
Collaborator

YaroShkvorets commented Nov 8, 2024

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

0237h commented Nov 11, 2024

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

@0237h
Copy link
Collaborator

0237h commented Nov 20, 2024

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

YaroShkvorets commented Nov 20, 2024

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

YaroShkvorets commented Nov 20, 2024

  1. make --api-key required for graph publish when --subgraph-id is supplied

@YaroShkvorets
Copy link
Collaborator

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

@0237h 0237h merged commit 428fe36 into main Nov 21, 2024
10 checks passed
@0237h 0237h deleted the fix/website branch November 21, 2024 15:02
0237h added a commit to 0237h/graph-tooling that referenced this pull request Nov 21, 2024
…#1760)

* update NETWORK_SUBGRAPH_MAINNET & add `api-key` to CLI

* Fail publish if missing API key with Subgraph ID

* get version from network subgraph

---------

Co-authored-by: Etienne Donneger <etienne@pinax.network>
Co-authored-by: YaroShkvorets <shkvorets@gmail.com>
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

Successfully merging this pull request may close these issues.

CLI website uses deprecated network endpoints
3 participants