-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple environment-based PHP configuration
This adds a layer of common sense on top of the other changes I've worked on to allow easy configuration variable setting. Fixes #166
- Loading branch information
1 parent
0a88c65
commit 08592a3
Showing
3 changed files
with
49 additions
and
0 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
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,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
echo "Checking for php configuration in environment" | ||
|
||
localinifile="/usr/local/etc/php/conf.d/10-local.ini" | ||
|
||
cat <<'EOF' > $localinifile | ||
; -- | ||
; Automatically generated php ini configuration for Moodle | ||
; -- | ||
EOF | ||
|
||
env | while IFS= read -r line; do | ||
value=${line#*=} | ||
fullname=${line%%=*} | ||
if [[ $fullname = INI-* ]]; then | ||
name=`echo $fullname | sed 's/^INI-//'` | ||
echo "=> Found '${name}' with value '${value}'" | ||
|
||
cat << EOF >> $localinifile | ||
; $fullname=$value | ||
$name = $value | ||
EOF | ||
fi | ||
done |