-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewriting values in PHP to avoid escaping hell
- Loading branch information
Showing
3 changed files
with
42 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
Rewrite config.php and manager_auth.php to replace expected patterns based on | ||
envrion values. | ||
*/ | ||
|
||
// APP_URL must not be set in mixed mode as there are two distinct URLs | ||
if (getenv("ACCESS_MODE") == "mixed"){ | ||
$_SERVER['APP_URL'] = ''; | ||
} | ||
|
||
foreach (array('config.php', 'manager_auth.php') as $fname) { | ||
$config_text = file_get_contents($fname); | ||
foreach(array("ADMIN_USERNAME", "ADMIN_PASSWORD", "UI_TIMEZONE", "UI_LANG", "APP_URL") as $pattern) { | ||
$config_text = str_replace($pattern, getenv($pattern), $config_text); | ||
} | ||
file_put_contents($fname, $config_text); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters