Skip to content

Commit

Permalink
Update prepare-config script
Browse files Browse the repository at this point in the history
- Reduce verbosity
- Only set permissions of dynamic config file (not it's containing
directory)
- Correctly use redis user and group from template
  • Loading branch information
danielkza committed Nov 25, 2016
1 parent b22c3e3 commit 4ed1988
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions templates/prepare-config.sh.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash

set -ex
set -e

redis_user="{{ redis_user }}"
redis_group="{{ redis_group }}"

static_cfg="$1"
dyn_cfg="$2"
Expand Down Expand Up @@ -29,6 +32,6 @@ else
dyn_cfg_data=$(sed -n '/CONFIG REWRITE/,$p' "$dyn_cfg";
grep -F 'sentinel myid' "$dyn_cfg" || :)
cat "$static_cfg" - <<< "$dyn_cfg_data" | filter_cfg > "$dyn_cfg"
chown "$redis_user:$redis_group" "$dyn_cfg"
chmod 0640 "$dyn_cfg"
fi

chown -R redis:redis "$(dirname "$dyn_cfg")"

0 comments on commit 4ed1988

Please sign in to comment.