The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hyperlane-monorepo/tools/keymaster/config.py

28 lines
790 B

from python_json_config import ConfigBuilder
import json
def load_config(path: str):
# create config parser
builder = ConfigBuilder()
# parse config
try:
config = builder.parse_config(path)
config.merge_with_env_variables(["KEYMASTER"])
# TODO: Validate config
# networks.name.rpc must be a uri
# networks.name.bank must be a hexkey
# networks.name.threshold must be in gwei
# homes.name must be present in networks
# homes.name.replicas must be present in networks
# homes.name.addresses must be unique (?)
return config.to_dict()
except json.decoder.JSONDecodeError:
# Failed to load config
return False
# merge config with environment variables