rover icon indicating copy to clipboard operation
rover copied to clipboard

support .`env` files like `apollo` CLI

Open prasek opened this issue 4 years ago • 4 comments

Description

Would be great to support .env files like the apollo CLI does: https://www.apollographql.com/docs/devtools/cli/#provide-an-api-key

prasek avatar Jul 30 '21 20:07 prasek

This support was introduced hastily to the apollo CLI and there was at least some consensus that this was problematic behavior to enable by default. Not the least of which is that .env is a somewhat magic mechanism that is best enabled explicitly and involves secrets which often need various flexibilities that are application-specific (e.g., .env.staging, etc.). It also conflicts with patterns and tooling that already exists and is mature on its own, like the popular direnv project and puts the expectations of projects like Node.js' dotenv package on Rover.

In considering this, we should take time to identify other commonly adopted use-cases of this in the wild besides apollo. I also think we should alternative proposals which may very well include a more principled mechanism for using these with the currently-existing profiles feature that lives within Rover.

abernix avatar Aug 02 '21 07:08 abernix

Agree - .env files are an environment thing that varies between languages and introducing support for it introduces yet another source of confusion for authentication.

Folks should use whatever auth setup works best for them, and Rover already has quite a bit of flexibility in this regard with the combination of profiles and environment variables.

EverlastingBugstopper avatar Aug 02 '21 14:08 EverlastingBugstopper

docker and docker-compose are a good language independent references to checkout:

  • docker supports a --env-file flag.
  • docker-compose.yml supports an env_file option as well
  • docker-compose supports https://docs.docker.com/compose/environment-variables/

In local dev/test it's not uncommon to already have a docker-compose env_file, so not having to repeat yourself with redundant configs/scripts would be nice.

Would be worth exploring how we might safely enable use of an env_file even if we don't support a default .env file like the apollo CLI. In addition to supporting a --env-file flag, the supergraph.yaml in https://github.com/apollographql/rover/issues/698 could support something like docker-compose.yml does:

    env_file: 
      - graph-dev.env

prasek avatar Aug 05 '21 22:08 prasek

Possibly closed by https://github.com/apollographql/rover/pull/2730

UpcraftLP avatar Oct 02 '25 17:10 UpcraftLP