foreman icon indicating copy to clipboard operation
foreman copied to clipboard

Read environment variables directly from CLI command

Open ecbrodie opened this issue 7 years ago • 4 comments

It would be nice if Foreman supported passing environment variables through the Procfile to the associated commands directly from the CLI command, instead of requiring all environment variable to be specified in the .env file. The current approach is quite limited, while my proposed approach allows for a lot of flexibility that most runner apps similar to Foreman allow for.

For example, if I wanted to ad-hoc pass the variable FOO_BAR=1 to my Procfile-based app and not want to export the variable, then I would love to just enter in this command:

FOO_BAR=1 foreman start

ecbrodie avatar Apr 02 '18 16:04 ecbrodie

@ddollar if this behaviour doesn't exist right now in Foreman (which I personally doubt it does), would you be welcoming to a PR that introduces this functionality? Having support for this will simplify some use cases for the application that I work on, thus giving me motivation to contribute.

ecbrodie avatar Apr 03 '18 14:04 ecbrodie

@ecbrodie is this still an issue?

andrewmcodes avatar Mar 18 '19 22:03 andrewmcodes

I'm not sure, I'm not currently working on a Rails project that uses Foreman at the moment. Feel free to close this issue if you think the linked PR fixed it. I'll request to reopen it if I find any problems in the future.

ecbrodie avatar Mar 18 '19 23:03 ecbrodie

@ecbrodie: check env command, you can have something like env MY_VAR=1 command --arg=1 env run command in modified environment which is convenient workaround for what you are asking I guess.

spinus avatar Dec 01 '19 22:12 spinus