From 924ce7e267e8b19132477d88f46b504b111194ec Mon Sep 17 00:00:00 2001 From: Riccardo Persiani Date: Mon, 24 Feb 2025 16:08:49 +0100 Subject: [PATCH 1/2] feat: <- add env checker --- simple-block-agreement/operator/src/index.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/simple-block-agreement/operator/src/index.ts b/simple-block-agreement/operator/src/index.ts index 6a87e25..ec74449 100644 --- a/simple-block-agreement/operator/src/index.ts +++ b/simple-block-agreement/operator/src/index.ts @@ -6,6 +6,22 @@ import { getData } from './data/get-data' dotenv.config() const main = async () => { + const requiredEnvVars = [ + 'BEACONCHAIN_API', + 'THE_GRAPH_API', + 'BAPP_ADDRESS', + 'USE_EXPONENTIAL_WEIGHT', + 'USE_HARMONIC_COMBINATION_FUNCTION', + 'PRIVATE_KEYS', + ] + + requiredEnvVars.forEach((envVar) => { + if (!process.env[envVar]) { + console.error(`Missing required environment variable: ${envVar}`) + process.exit(1) + } + }) + const app = new App() const bAppAddress = process.env.BAPP_ADDRESS || '' From 51cabe0ef6be0e91dbe2caae2b07c5558f70cbfb Mon Sep 17 00:00:00 2001 From: Riccardo Persiani Date: Mon, 24 Feb 2025 17:15:47 +0100 Subject: [PATCH 2/2] chore: <- include env source step --- simple-block-agreement/README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/simple-block-agreement/README.md b/simple-block-agreement/README.md index 82104f0..1005944 100644 --- a/simple-block-agreement/README.md +++ b/simple-block-agreement/README.md @@ -18,10 +18,6 @@ This repository contains the core Based Applications Contracts, including UUPS u ## :page_with_curl: _Instructions for Operator_ -**0)** Install a command line tool to load your env automatically, like: - -__`❍ brew install autoenv`__ - **1)** Fire up your favorite console & clone this repo somewhere: __`❍ git clone https://github.com/ssvlabs/examples.git`__ @@ -38,9 +34,9 @@ __`❍ npm install`__ __`❍ cp .env.example .env`__ -**5)** Load the env: +**5)** Load the env in your favorite way: -__`❍ cd .`__ +__`❍ source .env`__ **6)** Make sure env is loaded correctly: