-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(repo): Automate running fuel-core-nats locally (#20)
* build(repo): allow starting & stopping nats server locally * build(repo): start nats with jetstream always * fix(fuel-core-nats): remove trailing '.' in 'assets' subject * build(fuel-core-nats): automate running fuel-core-nats locally * refactor(fuel-core-nats): re-introduce command as dev/run-node * refactor(fuel-core-nats): improve fuel core nats dev script This change allows creating a .env file matching the templated environment variables from .env.sample to start the fuel-core-nats service locally.
- Loading branch information
1 parent
08b6ccf
commit 5519c83
Showing
3 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
KEYPAIR=generated-p2p-secret | ||
RELAYER=https://sepolia.infura.io/v3/infura-api-key | ||
RELAYER_V2_LISTENING_CONTRACTS=0x768f9459E3339A1F7d59CcF24C80Eb4A711a01FB | ||
RELAYER_DA_DEPLOY_HEIGHT=5791365 | ||
RELAYER_LOG_PAGE_SIZE=2000 | ||
SYNC_HEADER_BATCH_SIZE=100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# Load environment variables from .env file | ||
if [ -f .env ]; then | ||
export $(grep -v '^#' .env | xargs) | ||
else | ||
echo ".env file not found. Please create a .env file using the '.env.sample' template and try again." | ||
exit 1 | ||
fi | ||
|
||
# Function to check if environment variables are set | ||
check_env_vars() { | ||
local missing_vars=0 | ||
|
||
while IFS= read -r line; do | ||
# Skip empty lines and comments | ||
[[ -z "$line" || "$line" == \#* ]] && continue | ||
|
||
# Extract the key | ||
key=$(echo "$line" | cut -d '=' -f 1) | ||
|
||
# Check if the key is set in the environment | ||
if [ -z "${!key}" ]; then | ||
echo "Environment variable $key is not set." | ||
missing_vars=$((missing_vars + 1)) | ||
fi | ||
done < ".env.sample" | ||
|
||
return $missing_vars | ||
} | ||
|
||
check_env_vars | ||
|
||
cargo run -p fuel-core-nats -- \ | ||
--service-name "NATS Publisher Node" \ | ||
--ip 0.0.0.0 \ | ||
--port 4000 \ | ||
--peering-port 30333 \ | ||
--db-path tmp/fuel-core-db \ | ||
--utxo-validation \ | ||
--poa-instant false \ | ||
--enable-p2p \ | ||
--keypair $KEYPAIR \ | ||
--sync-header-batch-size $SYNC_HEADER_BATCH_SIZE \ | ||
--enable-relayer \ | ||
--relayer $RELAYER \ | ||
--relayer-v2-listening-contracts $RELAYER_V2_LISTENING_CONTRACTS \ | ||
--relayer-da-deploy-height $RELAYER_DA_DEPLOY_HEIGHT \ | ||
--relayer-log-page-size $RELAYER_LOG_PAGE_SIZE \ |