45 lines
1.7 KiB
Python
Raw Normal View History

2024-12-13 15:58:25 +08:00
import os
from dotenv import load_dotenv
load_dotenv() # This will load environment variables from a .env file if it exists
def get_env_var(var_name, default=None):
env_var = os.getenv(var_name, default)
if env_var in [None, ""]:
print(f"{var_name} is not set; using default value: {default}")
env_var = default
print(f"{var_name}: {env_var}")
return env_var
# Configuration constants. Need to be upercase to appear in reports
2024-12-19 13:51:15 +08:00
DEFAULT_NOMOS = {
"image": "nomos:latest",
"volumes": "./testnet:/etc/nomos,./tests/kzgrs/kzgrs_test_params:/kzgrs_test_params:z",
"ports": "3000/udp,18080/tcp",
"entrypoint": "/etc/nomos/scripts/run_nomos_node.sh",
}
NOMOS_EXECUTOR = {
"image": "nomos:latest",
"volumes": "./testnet:/etc/nomos,./tests/kzgrs/kzgrs_test_params:/kzgrs_test_params:z",
"ports": "3000/udp,18080/tcp",
"entrypoint": "/etc/nomos/scripts/run_nomos_executor.sh",
}
CFGSYNC = {"image": "nomos:latest", "volumes": "./testnet:/etc/nomos", "ports": "", "entrypoint": "/etc/nomos/scripts/run_cfgsync.sh"}
CFGSYNC = get_env_var("CFGSYNC", CFGSYNC)
2024-12-13 15:58:25 +08:00
NODE_1 = get_env_var("NODE_1", DEFAULT_NOMOS)
2024-12-19 13:51:15 +08:00
NODE_2 = get_env_var("NODE_2", NOMOS_EXECUTOR)
2024-12-13 15:58:25 +08:00
ADDITIONAL_NODES = get_env_var("ADDITIONAL_NODES", f"{DEFAULT_NOMOS},{DEFAULT_NOMOS}")
# more nodes need to follow the NODE_X pattern
DOCKER_LOG_DIR = get_env_var("DOCKER_LOG_DIR", "./log/docker")
NETWORK_NAME = get_env_var("NETWORK_NAME", "nomos")
SUBNET = get_env_var("SUBNET", "172.19.0.0/16")
IP_RANGE = get_env_var("IP_RANGE", "172.19.0.0/24")
GATEWAY = get_env_var("GATEWAY", "172.19.0.1")
RUNNING_IN_CI = get_env_var("CI")
API_REQUEST_TIMEOUT = get_env_var("API_REQUEST_TIMEOUT", 20)