From fd9a5b7ac47f6ace491d915e0ffb172af19573d9 Mon Sep 17 00:00:00 2001 From: conache Date: Fri, 9 Aug 2024 13:29:25 +0300 Subject: [PATCH] Add init.config file --- README.md | 4 ++-- init.docker => init.config | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) rename init.docker => init.config (60%) diff --git a/README.md b/README.md index 4644a28..4b9d78b 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ A complete working example is provided in the `docker-compose.yml` file. Run the following commands from the project's root directory to initialize the worker: ```sh - chmod +x init.docker - ./init.docker + chmod +x init.config + ./init.config ``` These commands will: - Automatically create Allora keys for your worker. diff --git a/init.docker b/init.config similarity index 60% rename from init.docker rename to init.config index ee4d658..2057f07 100755 --- a/init.docker +++ b/init.config @@ -9,7 +9,20 @@ fi nodeName=$(jq -r '.wallet.addressKeyName' config.json) if [ -z "$nodeName" ]; then - echo "No name was provided for the node, please provide value for wallet.addressKeyName in the config.json" + echo "No wallet name provided for the node, please provide your preferred wallet name. config.json >> wallet.addressKeyName" + exit 1 +fi + +json_content=$(cat ./config.json) +stringified_json=$(echo "$json_content" | jq -c .) + +mnemonic=$(jq -r '.wallet.addressRestoreMnemonic' config.json) +if [ -n "$mnemonic" ]; then + echo "ALLORA_OFFCHAIN_NODE_CONFIG_JSON='$stringified_json'" > ./worker-data/env_file + echo "NAME=$nodeName" >> ./worker-data/env_file + echo "ENV_LOADED=true" >> ./worker-data/env_file + + echo "wallet mnemonic already provided by you, loading config.json . Please proceed to run docker compose" exit 1 fi