Skip to content

Generates .env file with rover init #2652

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

Merged
merged 3 commits into from
Jul 10, 2025

Conversation

DMallare
Copy link

@DMallare DMallare commented Jul 10, 2025

  • Generates .env file with rover init containing the user's APOLLO_GRAPH_REF and APOLLO_KEY
  • Updates the subsequent rover dev prompt to no longer use the inline variables

Testing

Scenario 1: connectors (Start a graph with one or more REST APIs)

dmallare@Mac ellie-test % ../test-rover init

Welcome! This command helps you initialize a federated graph in your current directory.

To learn more about init, run `rover init -h` or visit https://www.apollographql.com/docs/rover/commands/init

? Choose an action: Create a new supergraph
? How would you like to get started: Connect to REST services with Apollo Connectors
? Name your supergraph: ellie-test-rest
Confirm or modify graph ID (start with a letter and use only letters, numbers, and dashes): ellie-test-rest-s22ttlk
? Name your schema: hello-world

==> You’re about to add the following files to your local directory:

.env
README.md
connectors_debugger.png
getting-started.md
schema.graphql
.idea/
  .gitignore
  graphql-settings.xml
.vscode/
  extensions.json

? Proceed with creation? [Y/n]
Y

✓ Successfully created files and generated GraphOS credentials.

All set! Your graph 'ellie-test-rest' has been created. Please review details below to see what was generated.

✓ .env
✓ README.md
✓ connectors_debugger.png
✓ getting-started.md
✓ schema.graphql
✓ .idea/
✓   .gitignore
✓   graphql-settings.xml
✓ .vscode/
✓   extensions.json

GraphOS credentials for your graph
APOLLO_GRAPH_REF=ellie-test-rest-s22ttlk@current (Formatted graph-id@variant, references a graph in the Apollo GraphOS platform)
APOLLO_KEY=service:ellie-test-rest-s22ttlk:qX0a1bFup6GfQPFztM14fQ (This is your graph's API key)

Writing APOLLO_KEY to .env

Next steps
Start a local development session:

rover dev

For more information, check out 'getting-started.md'.

dmallare@Mac ellie-test % ../test-rover dev
merging supergraph schema files
supergraph config loaded successfully
starting a session with the 'hello-world' subgraph
==> Watching /Users/dmallare/ellie-test/schema.graphql for changes
composing supergraph with Federation 2.11.0
==> Attempting to start router at http://localhost:4000.
==> Health check exposed at http://127.0.0.1:8088/health
WARN: Connector debugging is enabled, this may expose sensitive information.
==> Your supergraph is running! head to http://localhost:4000 to query your supergraph

Contents of .env file

APOLLO_KEY=service:<rest of key>

Scenario 2: Start a graph with recommended libraries

dmallare@Mac ellie-test % ../test-rover init

Welcome! This command helps you initialize a federated graph in your current directory.

To learn more about init, run `rover init -h` or visit https://www.apollographql.com/docs/rover/commands/init

? Choose an action: Create a new supergraph
? How would you like to get started: Build a GraphQL service with Apollo Server
? Select a language and server library template: Build an API with TypeScript and Apollo Server
? Name your supergraph: ellie-test
Confirm or modify graph ID (start with a letter and use only letters, numbers, and dashes): ellie-test-wj5yicj

==> You’re about to add the following files to your local directory:

.env
.gitignore
README.md
codegen.ts
getting-started.md
package-lock.json
package.json
schema.graphql
tsconfig.json
.vscode/
  extensions.json
src/
  index.ts
  __generated__/
  __tests__/
  resolvers/
  types/

? Proceed with creation? [Y/n]
Y

✓ Successfully created files and generated GraphOS credentials.

All set! Your graph 'ellie-test' has been created. Please review details below to see what was generated.

✓ .env
✓ .gitignore
✓ README.md
✓ codegen.ts
✓ getting-started.md
✓ package-lock.json
✓ package.json
✓ schema.graphql
✓ tsconfig.json
✓ .vscode/
✓   extensions.json
✓ src/
✓   index.ts
✓   __generated__/
✓   __tests__/
✓   resolvers/
✓   types/

GraphOS credentials for your graph
APOLLO_GRAPH_REF=ellie-test-wj5yicj@current (Formatted graph-id@variant, references a graph in the Apollo GraphOS platform)
APOLLO_KEY=service:<rest of the key> (This is your graph's API key)

Writing APOLLO_KEY to .env

Next steps
1) Start the subgraph server by running the following commands in order:

npm i
npm run dev

2) In a new terminal, start a local development session:

rover dev


For more information, check out 'getting-started.md'.


dmallare@Mac ellie-test % ../test-rover dev
merging supergraph schema files
supergraph config loaded successfully
starting a session with the 'unused' subgraph
==> Watching /Users/dmallare/ellie-test/schema.graphql for changes
composing supergraph with Federation 2.10.2
==> Attempting to start router at http://localhost:4000.
==> Health check exposed at http://127.0.0.1:8088/health
WARN: Connector debugging is enabled, this may expose sensitive information.
==> Your supergraph is running! head to http://localhost:4000 to query your supergraph

Contents of .env file

APOLLO_KEY=service:<rest of key>

@DMallare DMallare requested review from a team as code owners July 10, 2025 15:41
@apollo-librarian
Copy link
Contributor

apollo-librarian bot commented Jul 10, 2025

⚠️ Docs preview not attached to branch

The preview was not built because the PR's base branch release-0.35.0-beta is not in the list of sources.

An Apollo team member can comment one of the following commands to dictate which branch to attach the preview to:

  • !docs set-base-branch main

Build ID: cdb03f41c1cfc322d1670dfd

@DMallare DMallare force-pushed the dmallare/generate-env-with-rover-init branch from e2a83dd to eb96199 Compare July 10, 2025 15:50
@DMallare DMallare force-pushed the dmallare/generate-env-with-rover-init branch from eb96199 to 81ac632 Compare July 10, 2025 16:01
@DMallare DMallare force-pushed the dmallare/generate-env-with-rover-init branch 2 times, most recently from eea4f10 to 0216f64 Compare July 10, 2025 18:07
@DMallare DMallare force-pushed the dmallare/generate-env-with-rover-init branch from 0216f64 to 4941be1 Compare July 10, 2025 18:37
@DMallare DMallare merged commit 3b3065d into release-0.35.0-beta Jul 10, 2025
32 checks passed
@DMallare DMallare deleted the dmallare/generate-env-with-rover-init branch July 10, 2025 18:55
@DaleSeo DaleSeo added this to the v0.35.0 milestone Jul 30, 2025
@DaleSeo DaleSeo added the feature 🎉 new commands, flags, functionality, and improved error messages label Jul 30, 2025
@DaleSeo DaleSeo mentioned this pull request Jul 30, 2025
DaleSeo added a commit that referenced this pull request Jul 30, 2025
# [0.35.0] - 2025-07-30

## ❗ BREAKING ❗

- **use config file for MCP server - @nicholascioli PR #2665**

## 🚀 Features

- **Update MCP options for rover dev - @DaleSeo PR #2661**
- **Add schema name step to Connectors init workflow - @alyssahursh PR
#2647**
- **Allow running rover dev without --supergraph-config if you have a
rover.yaml in the current directory - @dylan-apollo PR #2650**
- **Updating output for init & renaming generated "supergraph.yaml" ->
"rover.yaml" - @tayrrible PR #2651**
- **Adds support for .env file for use with rover dev - @DMallare PR
#2646**
- **Add graph_ref to and remove federation_version from subgraph.yaml -
@alyssahursh PR #2649**
- **Hackathon improvements to supergraph.yaml - @dylan-apollo PR #2648**
- **Adding link to studio for graph & showing each step in creation
process via spinners - @tayrrible PR #2657**
- **Generates .env file with rover init - @DMallare PR #2652**
- **Remove use case guard clause in schema name prompt - @alyssahursh PR
#2655**
- **Set APOLLO_GRAPH_REF from rover.yaml's graph_ref - @dylan-apollo PR
#2653**
- **Adding apollo.config.yaml file for connectors projects - @tayrrible
PR #2658**
- **add a note about the need for APOLLO_KEY and APOLLO_GRAPH_REF when
using router features or connect - @the-gigi-apollo PR #2677**
- **Update Studio Client after loading .env in rover dev - @dylan-apollo
PR #2654**
- **Exposing org selector for all runs of init and changing prompt order
- @tayrrible PR #2656**


## 🛠 Maintenance

- **upgrade schemars and apollo-federation-types - @DaleSeo PR #2676**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎉 new commands, flags, functionality, and improved error messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants