Skip to content
Snippets Groups Projects
Commit bcc435a2 authored by Gilles Filippini's avatar Gilles Filippini
Browse files

feat(docker): revert DUNITER_MANUAL_CONFIG setting

Now that everythin in `conf.json` can be set from Docker environment
variables, `DUNITER_MANUAL_CONFIG` isn't useful anymore.
parent b27e8a2c
No related branches found
No related tags found
No related merge requests found
...@@ -31,44 +31,10 @@ fi ...@@ -31,44 +31,10 @@ fi
home=/var/lib/duniter home=/var/lib/duniter
home_default=$home/duniter_default home_default=$home/duniter_default
manual_config="$(boolean "${DUNITER_MANUAL_CONFIG:-false}")"
auto_sync="$(boolean "${DUNITER_AUTO_SYNC:-false}")" auto_sync="$(boolean "${DUNITER_AUTO_SYNC:-false}")"
mkdir -p "$home/duniter_default" mkdir -p "$home/duniter_default"
# Manual config when enabled
if [ "$manual_config" = true ]; then
# Do not start until a configuration file was initialized
while ! [ -f "$home_default/conf.json.orig" ]; do
echo "Waiting for initial configuration file... Please copy your configuration file to '$home_default/conf.json.orig'"
sleep 10
done
echo "Configuration file found. Continuing..."
# Use new conf.json.orig when changed
md5_file="$home_default/conf.json.orig.md5"
if ! md5sum -c "$md5_file"; then
if [ -f "$home_default/conf.json" ]; then
echo "Backing up old configuration file to '$home_default/conf.json.old'..."
mv $home_default/conf.json $home_default/conf.json.old
fi
echo "Installing new configuration file..."
cp "$home_default/conf.json.orig" "$home_default/conf.json"
md5sum "$home_default/conf.json.orig" >"$md5_file"
fi
# Log differences between initial, old and current conf file
jq --sort-keys -r . "$home_default/conf.json.orig" >"$home_default/conf.json.orig.sorted"
jq --sort-keys -r . "$home_default/conf.json" >"$home_default/conf.json.sorted"
if [ -f "$home_default/conf.json.old" ]; then
jq --sort-keys -r . "$home_default/conf.json.old" >"$home_default/conf.json.old.sorted"
if ! diff -q "$home_default/conf.json.old.sorted" "$home_default/conf.json.orig.sorted"; then
diff -u "$home_default/conf.json.old.sorted" "$home_default/conf.json.orig.sorted"
fi
fi
if ! diff -q "$home_default/conf.json.orig.sorted" "$home_default/conf.json.sorted"; then
diff -u "$home_default/conf.json.orig.sorted" "$home_default/conf.json.sorted"
fi
fi
# Auto start synchronization when enabled and starting from scratch # Auto start synchronization when enabled and starting from scratch
if [ "$auto_sync" = true ]; then if [ "$auto_sync" = true ]; then
if ! [ -d "$home_default/data" ]; then if ! [ -d "$home_default/data" ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment