Blame view

SET_DEBUG_MODE 696 Bytes
d9b30b03   Etienne Pallier   Bugfix & ameliora...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash

config_file="config/app.php"

function usage {
	echo
	echo "Usage:"
	echo "$0 ON/OFF"
	echo "- ON : set general debug mode ON"
	echo "- OFF : set general debug mode OFF"
	echo
}

[[ $1 != "ON" && $1 != "OFF" ]] && usage && exit

if [[ $1 == "OFF" ]] ; then
	# OFF
	CURRENT_VAL="true"
	NEW_VAL="false"
else
	# ON
	CURRENT_VAL="false"
	NEW_VAL="true"
fi

sed -e "s/'debug' => filter_var(env('DEBUG', $CURRENT_VAL)/'debug' => filter_var(env('DEBUG', $NEW_VAL)/" -i $config_file

# For Mac OS => replace -i with -i ''
#sed -e "s/'debug' => filter_var(env('DEBUG', $CURRENT_VAL)/'debug' => filter_var(env('DEBUG', $NEW_VAL)/" -i '' $config_file

echo
echo "DEBUG MODE is $1"
echo