diff --git a/scripts/__init_env__.php b/scripts/__init_env__.php index 8925464937..faf5fedcea 100644 --- a/scripts/__init_env__.php +++ b/scripts/__init_env__.php @@ -21,7 +21,9 @@ ini_set('include_path', $include_path.':'.dirname(__FILE__).'/../../'); require_once dirname(dirname(__FILE__)).'/conf/__init_conf__.php'; -$env = getenv('PHABRICATOR_ENV'); +$env = isset($_SERVER['PHABRICATOR_ENV']) + ? $_SERVER['PHABRICATOR_ENV'] + : getenv('PHABRICATOR_ENV'); if (!$env) { echo "Define PHABRICATOR_ENV before running this script.\n"; exit(1); diff --git a/scripts/mail/mail_handler.php b/scripts/mail/mail_handler.php index f2f5412e75..001a03491b 100755 --- a/scripts/mail/mail_handler.php +++ b/scripts/mail/mail_handler.php @@ -17,6 +17,10 @@ * limitations under the License. */ +if ($argc > 1) { + $_SERVER['PHABRICATOR_ENV'] = $argv[1]; +} + $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; require_once $root.'/scripts/__init_env__.php'; diff --git a/src/docs/configuring_inbound_email.diviner b/src/docs/configuring_inbound_email.diviner index 900e87ae73..f3ead1557a 100644 --- a/src/docs/configuring_inbound_email.diviner +++ b/src/docs/configuring_inbound_email.diviner @@ -47,7 +47,7 @@ probably means something like this: Now, you can actually configure sendmail to deliver to Phabricator. In ##/etc/aliases##, add an entry like this: - phabricator: "| PHABRICATOR_ENV= /path/to/phabricator/scripts/mail/mail_handler.php" + phabricator: "| /path/to/phabricator/scripts/mail/mail_handler.php " ...where is the PHABRICATOR_ENV the script should run under. Run ##sudo newaliases##. Now you likely need to symlink this script into