MCPcopy Create free account
hub / github.com/canopy-network/canopy / new_config_from_file

Function new_config_from_file

plugin/python/contract/plugin.py:64–73  ·  view source on GitHub ↗

Load configuration from JSON file (matching Go's NewConfigFromFile).

(filepath: str)

Source from the content-addressed store, hash-verified

62
63
64def new_config_from_file(filepath: str) -> Config:
65 """Load configuration from JSON file (matching Go's NewConfigFromFile)."""
66 try:
67 config_data = json.loads(Path(filepath).read_text(encoding="utf-8"))
68 return Config(
69 chain_id=config_data.get("chainId", 1),
70 data_dir_path=config_data.get("dataDirPath", "/tmp/plugin/"),
71 )
72 except Exception as err:
73 raise ValueError(f"Failed to load config from {filepath}: {err}")
74
75
76class Plugin:

Callers

nothing calls this directly

Calls 2

ConfigClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected