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

Add --replace flag to run command #302

Closed
zueve opened this issue Jan 28, 2021 · 3 comments · Fixed by #312
Closed

Add --replace flag to run command #302

zueve opened this issue Jan 28, 2021 · 3 comments · Fixed by #312

Comments

@zueve
Copy link
Contributor

zueve commented Jan 28, 2021

As a developer i need usually quick change environment, without changing .env file. That's why I need replace some parameters by fly.What should i do:

Without -r flag:

devenv run env | grep PORT
PORT=8000

With -r flag:

PORT=5000 devenv run -r 0 env | grep PORT
PORT=8000

@zueve
Copy link
Contributor Author

zueve commented Jan 28, 2021

#303

@colllin
Copy link

colllin commented Feb 4, 2021

Can you just dotenv run PORT=5000 env | grep PORT (move override into [COMMAND] instead of prefixing)? Or I take it you want to override from outer ENV? Then maybe you can do dotenv run PORT=$PORT env | grep PORT?

I’m sorry. Dotenv doesn’t work this way. It doesn’t eval the full command in a sub-shell, like some other similar tools. So in this case it looks for a program named PORT instead of a program named env. In hindsight, this could be an interesting way to solve this problem (as opposed to introducing a new flag). Another idea might be to allow to inline “set” variables, like dotenv run --set PORT=5000 env. Anyway, it’s clear to me now that this is a limitation of dotenv, and I see you’ve already submitted a PR to address it. 🙌

@zueve
Copy link
Contributor Author

zueve commented Feb 5, 2021

I use python-dotenv in Makefile and sometimes wants to change Environment like:

PORT=1222 make start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants