kohana / minion

Everyone loves having a minion they can boss around
113 stars 76 forks source link

Way to add to $_ENV when running minion #8

Closed zeelot closed 13 years ago

zeelot commented 13 years ago

This may very well be my lack of understanding of how PHP CLI works but in our bootstrap, we typically set different options depending on the values returned from getenv() calls.

Here is an example in the kohana/kohana bootstrap: https://github.com/kohana/kohana/blob/3.1/develop/application/bootstrap.php#L64

We also use ENVIRONMENT and APACHE_ENVIRONMENT in some of our applications... it seems like I should be able to add any number of values to $_ENV when running minion... usually I have a cli.php file next to index.php that uses putenv() a few times but I might just be doing it wrong...

ahutchings commented 13 years ago

You can set the KOHANA_ENV variable when running minion (or any other cli) tasks like this:

KOHANA_ENV=staging php index.php --uri=minion/module:#{task}
BRMatt commented 13 years ago

ahutchings is correct

  KOHANA_ENV='production' php -r "echo getenv('KOHANA_ENV');"
zeelot commented 13 years ago

thanks, carry on =P