mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Restart app only if config changed
This commit is contained in:
committed by
Jose Diaz-Gonzalez
parent
5f5e05bba6
commit
0ec9ecad08
@@ -9,6 +9,7 @@ if [[ $1 == config ]] || [[ $1 == config:* ]]; then
|
||||
else
|
||||
APP="$2"
|
||||
ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||
ENV_FILE_TEMP="$DOKKU_ROOT/$APP/ENV.tmp"
|
||||
|
||||
# Check if app exists with the same name
|
||||
if [ ! -d "$DOKKU_ROOT/$APP" ]; then
|
||||
@@ -59,6 +60,16 @@ config_restart_app() {
|
||||
echo "-----> Deploy complete!"
|
||||
}
|
||||
|
||||
config_write() {
|
||||
ENV_TEMP="$1"
|
||||
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
|
||||
if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then
|
||||
cp -f $ENV_FILE_TEMP $ENV_FILE
|
||||
config_restart_app $APP
|
||||
fi
|
||||
rm -f $ENV_FILE_TEMP
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
config)
|
||||
@@ -136,8 +147,7 @@ case "$1" in
|
||||
echo "-----> Setting config vars and restarting $APP"
|
||||
config_styled_hash "$ENV_ADD"
|
||||
|
||||
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE
|
||||
config_restart_app $APP
|
||||
config_write "$ENV_TEMP"
|
||||
fi
|
||||
;;
|
||||
|
||||
@@ -156,8 +166,7 @@ case "$1" in
|
||||
echo "-----> Unsetting $var and restarting $APP"
|
||||
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d")
|
||||
|
||||
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE
|
||||
config_restart_app $APP
|
||||
config_write "$ENV_TEMP"
|
||||
done
|
||||
;;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user