diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-07 18:38:10 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-07 18:38:10 +0200 |
commit | 038106cc4bca5e5a7273679bf090f8cca544679c (patch) | |
tree | e59480c112e69af91254f6c08bdc21ba55e4ea70 /.app/lib/app-conf | |
parent | 59ca77dc22f9356b8f5c400c94a04b1bda899ea6 (diff) | |
download | app.sh-038106cc4bca5e5a7273679bf090f8cca544679c.tar.gz app.sh-038106cc4bca5e5a7273679bf090f8cca544679c.tar.bz2 app.sh-038106cc4bca5e5a7273679bf090f8cca544679c.tar.xz app.sh-038106cc4bca5e5a7273679bf090f8cca544679c.zip |
o Renaming latest to current.
o Adding stop method.
o Saving pids under .apps/var/pid.
Diffstat (limited to '.app/lib/app-conf')
-rw-r--r-- | .app/lib/app-conf | 18 |
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 } |