From 2cb2a6d3205e436aabdce1014cf7a9d6d684894f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 28 Jan 2020 13:09:19 +0300 Subject: [PATCH] Add possibility to import different dump of chains - import dump only if `node` sub command passed - ACC env variable default value is `6000-privnet-blocks.acc.gz` - ACC env variable can be declared in `docker-compose` - ACC env variable can be one of: - `/6000-privnet-blocks.acc.gz` - `/1600-privnet-blocks-single.acc.gz` - custom path to dump of blockchain --- .docker/privnet-entrypoint.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.docker/privnet-entrypoint.sh b/.docker/privnet-entrypoint.sh index 4a0c80f82..65f38b80f 100755 --- a/.docker/privnet-entrypoint.sh +++ b/.docker/privnet-entrypoint.sh @@ -1,6 +1,19 @@ #!/bin/sh -if test -f /privnet-blocks.acc.gz; then - gunzip /privnet-blocks.acc.gz - /usr/bin/neo-go db restore -i /privnet-blocks.acc + +BIN=/usr/bin/neo-go + +if [ -z "$ACC"]; then + ACC=/6000-privnet-blocks.acc.gz fi -/usr/bin/neo-go "$@" + +case $@ in + "node"*) + echo "=> Try to restore blocks before running node" + if test -f $ACC; then + gunzip --stdout /$ACC > /privnet.acc + ${BIN} db restore -p --config-path /config -i /privnet.acc + fi + ;; +esac + +${BIN} "$@"