Skip to content

Commit

Permalink
add loop for extra dotenv files in Constants.php
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewandante committed Jun 7, 2017
1 parent 856aa79 commit 8305f08
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Core/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@
}
}

// Allow supplementary dotenv files to be specified. Will loop over them in order of declaration, each overloading
// This means that the last in the list will be the highest priority
// Should be declared as such: SS_EXTRA_DOT_ENVS='.env2, .env3'
if (getenv('SS_EXTRA_DOT_ENVS')) {
$extraDotenvs = explode(',', getenv('SS_EXTRA_DOT_ENVS'));
foreach ($extraDotenvs as $dotenv) {
$dotenv = trim(basename($dotenv));
foreach ([BASE_PATH, dirname(BASE_PATH)] as $path) {
try {
(new Dotenv($path, $dotenv))->overload();
} catch (Exception $e) {
// not found here
continue;
}
}
}
}

/**
* Validate whether the request comes directly from a trusted server or not
* This is necessary to validate whether or not the values of X-Forwarded-
Expand Down

0 comments on commit 8305f08

Please sign in to comment.