Skip to content

Instantly share code, notes, and snippets.

@fago
Created November 21, 2023 21:40
Show Gist options
  • Save fago/9c8aa6259baeeab54bd12e0ee7784d72 to your computer and use it in GitHub Desktop.
Save fago/9c8aa6259baeeab54bd12e0ee7784d72 to your computer and use it in GitHub Desktop.
diff --git a/dotenv/loader.php b/dotenv/loader.php
index 8892c11..3399685 100644
--- a/dotenv/loader.php
+++ b/dotenv/loader.php
@@ -227,15 +227,18 @@ public static function getSiteVariables($site = NULL, $site_variant = '') {
// The following process must follow the same logic as loader.sh, but instead
// evaluating .env content with bash we use dotenv to parse it.
$dotenv = new Dotenv();
- $dotenv->populate($dotenv->parse(PhappEnvironmentLoader::getDotenvFiles()));
- $dotenv->populate($dotenv->parse(PhappEnvironmentLoader::determineEnvironment()));
+ $dotenv->usePutenv(TRUE);
+ $dotenv->populate($dotenv->parse(PhappEnvironmentLoader::getDotenvFiles()), TRUE);
+ if ($env = PhappEnvironmentLoader::determineEnvironment()) {
+ $dotenv->populate($dotenv->parse($env), TRUE);
+ }
if (!getenv('PHAPP_ENV')) {
die("Missing .env file or PHAPP_ENV environment variable. Did you run phapp setup?");
}
- $dotenv->populate($dotenv->parse(PhappEnvironmentLoader::prepareDeterminedEnvironment()));
+ $dotenv->populate($dotenv->parse(PhappEnvironmentLoader::prepareDeterminedEnvironment()), TRUE);
// Match the request and prepare site-specific dotenv vars.
$site = drunomics\MultisiteRequestMatcher\RequestMatcher::getInstance()
->match();
- $dotenv->populate($dotenv->parse(PhappEnvironmentLoader::prepareAppEnvironment()));
+ $dotenv->populate($dotenv->parse(PhappEnvironmentLoader::prepareAppEnvironment()), TRUE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment