Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip_sim_create option to bypass some of the sim setup process. #234

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/*
sim-root
sim-keys
28 changes: 15 additions & 13 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,22 @@ if [ -z "${service##*simulator*}" ]; then
export CHIA_ROOT=/root/.chia/simulator/main
export self_hostname="0.0.0.0"

if [ -f /root/.chia/simulator/mnemonic ]; then
echo "Using provided mnemonic from /root/.chia/simulator/mnemonic"
# Use awk to trim leading and trailing whitespace while preserving internal spaces
mnemonic=$(awk '{$1=$1};1' /root/.chia/simulator/mnemonic)
if [[ ${skip_sim_create} != 'true' ]]; then
if [ -f /root/.chia/simulator/mnemonic ]; then
echo "Using provided mnemonic from /root/.chia/simulator/mnemonic"
# Use awk to trim leading and trailing whitespace while preserving internal spaces
mnemonic=$(awk '{$1=$1};1' /root/.chia/simulator/mnemonic)
fi

if [ -n "$mnemonic" ]; then # Check if mnemonic is non-empty after trimming
chia dev sim create --docker-mode --mnemonic "${mnemonic}"
else
chia dev sim create --docker-mode
fi

chia stop -d all
chia keys show --show-mnemonic-seed --json | jq -r '.keys[0].mnemonic' > /root/.chia/simulator/mnemonic
fi

if [ -n "$mnemonic" ]; then # Check if mnemonic is non-empty after trimming
chia dev sim create --docker-mode --mnemonic "${mnemonic}"
else
chia dev sim create --docker-mode
fi

chia stop -d all
chia keys show --show-mnemonic-seed --json | jq -r '.keys[0].mnemonic' > /root/.chia/simulator/mnemonic
fi

# shellcheck disable=SC2086
Expand Down
Loading