forked from hyperledger/indy-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_helper.py
56 lines (41 loc) · 1.55 KB
/
config_helper.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
from plenum.common.config_helper import PConfigHelper
class ConfigHelper(PConfigHelper):
@property
def log_dir(self):
return self.chroot_if_needed(
os.path.join(self.config.LOG_DIR, self.config.NETWORK_NAME))
@property
def genesis_dir(self):
return self.chroot_if_needed(
os.path.join(self.config.GENESIS_DIR, self.config.NETWORK_NAME))
@property
def keys_dir(self):
return self.chroot_if_needed(
os.path.join(self.config.KEYS_DIR, self.config.NETWORK_NAME, 'keys'))
@property
def ledger_base_dir(self):
return self.chroot_if_needed(self.config.LEDGER_DIR)
@property
def ledger_data_dir(self):
return self.chroot_if_needed(
os.path.join(self.config.LEDGER_DIR, self.config.NETWORK_NAME, 'data'))
@property
def log_base_dir(self):
return self.chroot_if_needed(self.config.LOG_DIR)
@property
def backup_dir(self):
return self.chroot_if_needed(self.config.BACKUP_DIR)
@property
def node_info_dir(self):
return self.chroot_if_needed(
os.path.join(self.config.NODE_INFO_DIR, self.config.NETWORK_NAME))
class NodeConfigHelper(ConfigHelper):
def __init__(self, name: str, config, *, chroot='/'):
assert name is not None
super().__init__(config, chroot=chroot)
self.name = name
@property
def ledger_dir(self):
return self.chroot_if_needed(
os.path.join(self.config.LEDGER_DIR, self.config.NETWORK_NAME, 'data', self.name))