-
Notifications
You must be signed in to change notification settings - Fork 0
/
source-env.sh
44 lines (38 loc) · 1.1 KB
/
source-env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Check if yq is installed
if ! command -v yq &> /dev/null
then
echo "yq is not installed. Please install it and try again."
return 1
fi
# Check for arguments
if [ "$#" -ne 1 ]; then
echo "Usage: $0 [goerli|local]"
return 1
fi
# Read the YAML file
CONFIG_FILE="config.yml"
case $1 in
goerli)
CHAIN_ID=$(yq e '.goerli.CHAIN_ID' $CONFIG_FILE)
EXECUTOR_MULTISIG=$(yq e '.goerli.EXECUTOR_MULTISIG' $CONFIG_FILE)
FOUNDRY_FUZZ_RUNS=$(yq e '.goerli.FOUNDRY_FUZZ_RUNS' $CONFIG_FILE)
;;
local)
CHAIN_ID=$(yq e '.local.CHAIN_ID' $CONFIG_FILE)
FOUNDRY_FUZZ_RUNS=$(yq e '.local.FOUNDRY_FUZZ_RUNS' $CONFIG_FILE)
;;
*)
echo "Invalid argument. Usage: $0 [goerli|local]"
return 1
;;
esac
# Export environment variables
export CHAIN_ID=$CHAIN_ID
export EXECUTOR_MULTISIG=$EXECUTOR_MULTISIG
export FOUNDRY_FUZZ_RUNS=$FOUNDRY_FUZZ_RUNS
# Print environment variables
echo "Environment variables set:"
echo "CHAIN_ID: $CHAIN_ID"
echo "EXECUTOR_MULTISIG: $EXECUTOR_MULTISIG"
echo "FOUNDRY_FUZZ_RUNS: $FOUNDRY_FUZZ_RUNS"