Skip to content

Commit fb29517

Browse files
author
Roman
committed
Update localnet.sh (add RUN_IN_DOCKER local env var)
1 parent 9ac6678 commit fb29517

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/localnet.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if [[ $BUILD_BINARY == "1" ]]; then
6161
fi
6262

6363
echo "*** Building chainspec..."
64-
"$BUILD_DIR/release/node-subtensor" build-spec --disable-default-bootnode --raw --chain $CHAIN >$FULL_PATH
64+
"$BUILD_DIR/release/node-subtensor" build-spec --disable-default-bootnode --raw --chain "$CHAIN" >"$FULL_PATH"
6565
echo "*** Chainspec built and output to file"
6666

6767
# Generate node keys
@@ -79,6 +79,7 @@ fi
7979

8080
if [ $BUILD_ONLY -eq 0 ]; then
8181
echo "*** Starting localnet nodes..."
82+
8283
alice_start=(
8384
"$BUILD_DIR/release/node-subtensor"
8485
--base-path /tmp/alice
@@ -107,11 +108,17 @@ if [ $BUILD_ONLY -eq 0 ]; then
107108
--unsafe-force-node-key-generation
108109
)
109110

111+
# Provide RUN_IN_DOCKER local environment variable if run script in the docker image
112+
if [ "${RUN_IN_DOCKER}" == "1" ]; then
113+
alice_start+=(--unsafe-rpc-external)
114+
bob_start+=(--unsafe-rpc-external)
115+
fi
116+
110117
trap 'pkill -P $$' EXIT SIGINT SIGTERM
111118

112119
(
113120
("${alice_start[@]}" 2>&1) &
114121
("${bob_start[@]}" 2>&1)
115122
wait
116123
)
117-
fi
124+
fi

0 commit comments

Comments
 (0)