Skip to content

Add ENV Vars Checker #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions simple-block-agreement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`__
Expand All @@ -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:

Expand Down
16 changes: 16 additions & 0 deletions simple-block-agreement/operator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || ''
Expand Down