blob: 8e2aad6c2abf5f09ae5c7d73e091ae0a42276ccb (
plain)
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
|
#!/usr/bin/env python3
# stdlib imports
import sys
import subprocess
# stdlib "from" imports
from pathlib import Path
import chutney.TorNet
# local imports
import network as network_module
from config import Config
assert __name__ == "__main__"
_SCRIPT_NAME = Path(sys.argv[0]).name
_SCRIPT_DIR = Path(sys.argv[0]).parent.resolve()
config = Config.load_json(Path(_SCRIPT_DIR).joinpath("arti.run.json"))
config.export_env()
if config.network is not None:
# Use CLI to create and serialize network, as specified in config.network
subprocess.check_call([config.chutney, "init", config.network])
# Load the configured network that we just created.
network = chutney.TorNet.Network.from_nodes_dir(
Path(config.chutney_data_dir).joinpath("nodes")
)
else:
# Create the default network via the network_module
network = network_module.make_network(config)
# Initialize to disk
network.init(data_dir=Path(config.chutney_data_dir))
network.bootstrap()
|