summaryrefslogtreecommitdiff
path: root/.app/lib/app-conf
diff options
context:
space:
mode:
Diffstat (limited to '.app/lib/app-conf')
-rw-r--r--.app/lib/app-conf18
1 files changed, 10 insertions, 8 deletions
diff --git a/.app/lib/app-conf b/.app/lib/app-conf
index 8cc4949..0761205 100644
--- a/.app/lib/app-conf
+++ b/.app/lib/app-conf
@@ -3,10 +3,9 @@
key_expr="[a-zA-Z][_a-zA-Z0-9]*\.[a-zA-Z][_a-zA-Z0-9]*"
get_conf() {
- key=$1
- default=$2
-
- file=$BASEDIR/$name/$instance/latest/etc/app.conf
+ local key=$1
+ local default=$2
+ local file=$BASEDIR/$name/$instance/latest/etc/app.conf
if [ ! -r $file ]
then
@@ -53,14 +52,17 @@ assert_key() {
}
conf_set() {
- key=$1
- value=$2
-
+ local key=$1
+ local value=$2
local file=$BASEDIR/$name/$instance/latest/etc/app.conf
assert_key "$key"
- sed "/^$key[ ]*=.*/d" $file > $file.tmp
+ if [ -r $file ]
+ then
+ sed "/^$key[ ]*=.*/d" $file > $file.tmp
+ fi
+
echo "$key=$value" >> $file.tmp
mv $file.tmp $file
}