Skip to content

Commit

Permalink
chore: fix localnet script for Mac/Linux (#890)
Browse files Browse the repository at this point in the history
Localnet script fix sed replace for Mac/Linux
  • Loading branch information
onikonychev authored and NibiruHeisenberg committed Sep 12, 2022
1 parent 756ebf1 commit 23e0ebb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/localnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ GRPC_PORT=9090
MNEMONIC="guard cream sadness conduct invite crumble clock pudding hole grit liar hotel maid produce squeeze return argue turtle know drive eight casino maze host"
GENESIS_COINS=1000000000unibi,10000000000000unusd

SEDOPTION=
if [[ "$OSTYPE" == "darwin"* ]]; then
SEDOPTION="''"
fi

# Stop nibid if it is already running
if pgrep -x "$BINARY" > /dev/null; then
echo_error "Terminating $BINARY..."
Expand Down Expand Up @@ -102,23 +107,23 @@ fi

# Enable API Server
echo_info "Enabling API server"
if sed -i '' '/\[api\]/,+3 s/enable = false/enable = true/' $HOME/.nibid/config/app.toml; then
if sed -i $SEDOPTION '/\[api\]/,+3 s/enable = false/enable = true/' $CHAIN_DIR/config/app.toml; then
echo_success "Successfully enabled API server"
else
echo_error "Failed to enable API server"
fi

# Enable Swagger Docs
echo_info "Enabling Swagger Docs"
if sed -i '' 's/swagger = false/swagger = true/' $HOME/.nibid/config/app.toml; then
if sed -i $SEDOPTION 's/swagger = false/swagger = true/' $CHAIN_DIR/config/app.toml; then
echo_success "Successfully enabled Swagger Docs"
else
echo_error "Failed to enable Swagger Docs"
fi

# Enable CORS for localnet
echo_info "Enabling CORS"
if sed -i '' 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $HOME/.nibid/config/app.toml; then
if sed -i $SEDOPTION 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $CHAIN_DIR/config/app.toml; then
echo_success "Successfully enabled CORS"
else
echo_error "Failed to enable CORS"
Expand Down

0 comments on commit 23e0ebb

Please sign in to comment.