Mise à jour effectuée, merci de nous signaler tout dysfonctionnement ! | Upgrade done, please let us know about any dysfunction!

Commit 1f4a6bfe authored by Gilles Filippini's avatar Gilles Filippini
Browse files

Check configuration file changes at startup

requires 'jq' to sort the files before comparing them.
parent b839c259
Pipeline #11725 passed with stages
in 43 minutes and 4 seconds
......@@ -59,6 +59,9 @@ VOLUME /etc/duniter
# expose ports
EXPOSE 9220 10901 20901
# install jq
RUN apk add jq
# use duniter user
USER duniter
WORKDIR /duniter
......
......@@ -37,6 +37,18 @@ if [ "$manual_config" = true ]; then
cp "$config/conf.json.orig" "$config/conf.json"
md5sum "$config/conf.json.orig" >"$md5_file"
fi
# Log differences between initial, old and current conf file
jq --sort-keys -r . "$config/conf.json.orig" >"$config/conf.json.orig.sorted"
jq --sort-keys -r . "$config/conf.json" >"$config/conf.json.sorted"
if [ -f "$config/conf.json.old" ]; then
jq --sort-keys -r . "$config/conf.json.old" >"$config/conf.json.old.sorted"
if ! diff -q "$config/conf.json.old.sorted" "$config/conf.json.orig.sorted"; then
diff -u "$config/conf.json.old.sorted" "$config/conf.json.orig.sorted"
fi
fi
if ! diff -q "$config/conf.json.orig.sorted" "$config/conf.json.sorted"; then
diff -u "$config/conf.json.orig.sorted" "$config/conf.json.sorted"
fi
fi
# Auto start synchronization when enabled and starting from scratch
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment