Modify redirect.php to use .env variables
This commit is contained in:
parent
0efa00ff68
commit
90d4ba62d0
12
.env.example
12
.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=
|
||||
|
17
redirect.php
17
redirect.php
@ -1,10 +1,17 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
// Load the .env file
|
||||
$dotenv = new Dotenv\Dotenv(__DIR__);
|
||||
$dotenv->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',
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user