dotenv-org / cli

47 stars 4 forks source link

Feature Request: Personal Environment Variables #35

Closed ajmnz closed 2 years ago

ajmnz commented 2 years ago

Hey 👋🏼

Basically, it would be a nice addition to be able to tell the CLI to ignore certain keys both for pulling and pushing.

My use case is that we use localtunnel to expose publically our local development server and store the assigned URL in an env variable. The problem is that everyone who works on the project will have different URLs, meaning that the key is constantly changing every time someone pushes and overrides the others' URL.

The idea is to have a .envignore file where we can specify which keys we want the CLI to completely ignore.

# .envignore

TUNNEL_URL
WHATEVER_KEY

This would only involve the CLI, that would be the one in charge of reading the ignore file and preventing them from being pushed or overwritten on pull. Either way, this is not something critical, but thought it could be a nice addition to the package. I could open a PR for it if you're up for contributions.

motdotla commented 2 years ago

Hi @ajmnz - this is a use case others have brought up privately as well - over our support email.

An additional example is DB_HOST often has a default but then individual team members might have a slight modification depending on their machine set up.

So we are exploring this, but also exploring it in a way that you could actually have 'private' or 'personal' envs. We want this reflected in the local .env AND in the ui. We have a couple ideas so hope to post soon about those.

ajmnz commented 2 years ago

'Personal' keys sound like a pretty neat addition! I see them as keys marked by an administrator (only in development), where each user is allowed to modify them without affecting the others'. So, like personal vaults that live within the "original" one and only store values for those allowed keys.

motdotla commented 2 years ago

Hi @ajmnz, ok give personal environment variables a test drive 🏎

I think they are going to be very handy. They are useful for the reasons you stated above but also useful when developing a new feature and you are not quite ready to share the environment variable with the team.

https://user-images.githubusercontent.com/3848/159595279-ca04cb5c-b732-4407-a6c2-f5053df0cbde.mp4

It's a hidden feature right now. To use it follow the instructions in the video, which are:

  1. Add the comment # personal.dotenv.org to your .env file
  2. Place all personal environment variables below that comment
  3. Push and pull as usual. That's it!