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

Pass dotenvVault as argument #228

Open
www-chique opened this issue Jan 25, 2023 · 2 comments
Open

Pass dotenvVault as argument #228

www-chique opened this issue Jan 25, 2023 · 2 comments

Comments

@www-chique
Copy link

www-chique commented Jan 25, 2023

Proposal

Ability to pass DOTENV_VAULT in arguments in the command line.
For example:
npx dotenv-vault pull production --dotenvMe=me_b1831e… --dotenvVault=vlt_0a2981c4d...

Why?

I have the same code deployed across multiple production "apps", which vary from one another purely based on some environment variables, such as "SITE_TITLE", "API_LINK", and so on.
When I deploy it to production using a service, it pulls the environment variables using dotenv-vault pull, builds the app, and deploys.
Since I want to use the same repository for different apps, I would like to pull different set of env variables depending on which app it is. This can be achieved if I can supply the dotenvVault argument in the build command, and hence, won't need to commit the .env.vault (or .env.project) into the repository and lock the repository to one particular app.

Alternatives I have thought

  1. Using different "environments" for each project, like dotenv-vault pull production_projectA and dotenv-vault pull production_projectB and so on, but the experience will not be good when it comes to managing the projects.
  2. Creating different repositories and including the main repository as a dependency, so each repository can have it's own project, while the shared code goes into the dependency. This isn't feasible for me (the entire project is shared, so it doesn't make much sense to create an empty repository with just one dependency, and a .env.vault file).

I'll be very happy if someone can point me to the right direction, not necessarily the solution I have proposed.

@motdotla
Copy link
Member

Interesting and good use case. Putting this on the roadmap.

@motdotla
Copy link
Member

motdotla commented Nov 4, 2023

For now you can do DOTENV_VAULT=vlt_1234 npx dotenv-vault pull production --dotenvMe=me_b1831e…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: No status
Development

No branches or pull requests

2 participants