|
| 1 | +import os |
| 2 | +from dotenv import load_dotenv |
| 3 | + |
| 4 | +load_dotenv() # This will load environment variables from a .env file if it exists |
| 5 | + |
| 6 | + |
| 7 | +def get_env_var(var_name, default=None): |
| 8 | + env_var = os.getenv(var_name, default) |
| 9 | + if env_var in [None, ""]: |
| 10 | + print(f"{var_name} is not set; using default value: {default}") |
| 11 | + env_var = default |
| 12 | + print(f"{var_name}: {env_var}") |
| 13 | + return env_var |
| 14 | + |
| 15 | + |
| 16 | +# Configuration constants. Need to be upercase to appear in reports |
| 17 | +DEFAULT_NWAKU = "wakuorg/nwaku:latest" |
| 18 | +STRESS_ENABLED = False |
| 19 | +USE_WRAPPERS = True |
| 20 | +NODE_1 = get_env_var("NODE_1", DEFAULT_NWAKU) |
| 21 | +NODE_2 = get_env_var("NODE_2", DEFAULT_NWAKU) |
| 22 | +ADDITIONAL_NODES = get_env_var("ADDITIONAL_NODES", f"{DEFAULT_NWAKU},{DEFAULT_NWAKU},{DEFAULT_NWAKU}") |
| 23 | +# more nodes need to follow the NODE_X pattern |
| 24 | +DOCKER_LOG_DIR = get_env_var("DOCKER_LOG_DIR", "./log/docker") |
| 25 | +NETWORK_NAME = get_env_var("NETWORK_NAME", "waku") |
| 26 | +SUBNET = get_env_var("SUBNET", "172.18.0.0/16") |
| 27 | +IP_RANGE = get_env_var("IP_RANGE", "172.18.0.0/24") |
| 28 | +GATEWAY = get_env_var("GATEWAY", "172.18.0.1") |
| 29 | +RUNNING_IN_CI = get_env_var("CI") |
| 30 | +API_REQUEST_TIMEOUT = get_env_var("API_REQUEST_TIMEOUT", 20) |
| 31 | +RLN_CREDENTIALS = get_env_var("RLN_CREDENTIALS") |
| 32 | +PG_USER = get_env_var("POSTGRES_USER", "postgres") |
| 33 | +PG_PASS = get_env_var("POSTGRES_PASSWORD", "test123") |
| 34 | + |
| 35 | +# example for .env file |
| 36 | +# RLN_CREDENTIALS = {"rln-relay-cred-password": "password", "rln-relay-eth-client-address": "https://rpc.sepolia.linea.build", "rln-relay-eth-contract-address": "0xB9cd878C90E49F797B4431fBF4fb333108CB90e6", "rln-relay-eth-private-key-1": "", "rln-relay-eth-private-key-2": "", "rln-relay-eth-private-key-3": "", "rln-relay-eth-private-key-4": "", "rln-relay-eth-private-key-5": ""} |
0 commit comments