From 90d4ba62d058c441afd83eed42e223a112edd790 Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Thu, 18 Jan 2018 01:10:37 -0500 Subject: [PATCH] Modify redirect.php to use .env variables --- .env.example | 12 +++++++++--- redirect.php | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 1b722a1..3c04226 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,9 @@ -REDMINE_URL="https://hq.example.com" -REDMINE_API_KEY="abc123" -DEBUG_MODE=FALSE +REDMINE_URL='https://redmine.example.com' +# Used to get mappings. +REDMINE_API_KEY='' +# Used for sending email to Redmine. Not sure if these can be consolidated atm. +KEY='' +# Leave these two blank for false. +CATCHALL_PROJECT_NAME='catch' +DEBUG_MODE= +DRY_RUN= diff --git a/redirect.php b/redirect.php index 05b3788..ab116af 100755 --- a/redirect.php +++ b/redirect.php @@ -1,10 +1,17 @@ #!/usr/bin/php load(); + // Debug Mode will show more information. -$debugMode = TRUE; +$debugMode = getenv('DEBUG_MODE'); // Dry Run Mode will suppress sending an e-mail to Redmine. Only really useful with debug mode on. -$dryRun = FALSE; +$dryRun = getenv('DRY_RUN'); if($debugMode) { error_reporting(E_ALL); @@ -13,11 +20,11 @@ if($debugMode) { // initialize. $deliveredTo = $from = $project = $email = $subject = NULL; $params = array( - 'url' => 'https://hq.megaphonetech.com', - 'key' => '4kaq0ZLsWDndWEKN8O3D', + 'url' => getenv('REDMINE_URL'), + 'key' => getenv('KEY'), 'unknown-user' => 'create', 'allow-override' => 'all', - 'project' => 'catch', + 'project' => getenv('CATCHALL_PROJECT_NAME'), 'tracker' => 'general', );