Skip to content

Commit 3f2c62f

Browse files
authored
Doc: configuration module (#493)
1 parent 6206a7e commit 3f2c62f

File tree

4 files changed

+77
-29
lines changed

4 files changed

+77
-29
lines changed

src/aleph/chains/chain_service.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ async def chain_event_loop(self, config: Config):
9191
if config.ethereum.packing_node.value:
9292
publisher_tasks.append(self.chain_writer_task(Chain.ETH, config))
9393

94+
if config.nuls2.enabled.value:
95+
listener_tasks.append(self.chain_reader_task(Chain.NULS2, config))
96+
if config.nuls2.packing_node.value:
97+
publisher_tasks.append(self.chain_writer_task(Chain.NULS2, config))
98+
9499
if config.tezos.enabled.value:
95100
listener_tasks.append(self.chain_reader_task(Chain.TEZOS, config))
96101

src/aleph/commands.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ async def main(args: List[str]) -> None:
109109
LOGGER.critical(msg)
110110
raise KeyNotFoundException(msg)
111111

112-
if args.port:
113-
config.aleph.port.value = args.port
114-
if args.host:
115-
config.aleph.host.value = args.host
116-
117112
if args.sentry_disabled:
118113
LOGGER.info("Sentry disabled by CLI arguments")
119114
else:

src/aleph/config.py

Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,132 +6,185 @@
66
def get_defaults():
77
return {
88
"logging": {
9+
# Logging level.
910
"level": logging.WARNING,
11+
# Max log file size for each process.
1012
"max_log_file_size": 50_000_000, # 50MB
1113
},
1214
"aleph": {
15+
# Name of the P2P pubsub topic used to distribute pending messages across the aleph.im network.
1316
"queue_topic": "ALEPH-TEST",
14-
"host": "0.0.0.0",
15-
"port": 8000,
17+
# URL of another Core Channel Node to compare the synchronization status.
1618
"reference_node_url": None,
19+
# URL of the aleph.im cross-chain indexer.
1720
"indexer_url": "https://multichain.api.aleph.cloud",
1821
"balances": {
22+
# Addresses allowed to publish balance updates.
1923
"addresses": [
2024
"0xB34f25f2c935bCA437C061547eA12851d719dEFb",
2125
"0xa1B3bb7d2332383D96b7796B908fB7f7F3c2Be10",
2226
],
27+
# POST message type for balance updates.
2328
"post_type": "balances-update",
2429
},
2530
"jobs": {
2631
"pending_messages": {
32+
# Maximum number of retries for a message.
2733
"max_retries": 10,
34+
# Maximum number of messages/files fetched at the same time.
2835
"max_concurrency": 10,
29-
"store": 30,
3036
},
3137
"pending_txs": {
38+
# Maximum number of chain/sync events processed at the same time.
3239
"max_concurrency": 20,
3340
},
3441
},
3542
},
3643
"p2p": {
44+
# Port used for HTTP communication between nodes.
3745
"http_port": 4024,
46+
# Port used for P2P communication between nodes.
3847
"port": 4025,
48+
# Port used to communicate with the local P2P service.
3949
"control_port": 4030,
50+
# Hostname of the P2P service.
4051
"daemon_host": "p2p-service",
52+
# Hostname of the RabbitMQ service, as viewed by the Core Channel Node code.
4153
"mq_host": "rabbitmq",
54+
# Delay between connection attempts to other nodes on the network.
4255
"reconnect_delay": 60,
56+
# P2P pubsub topic used for liveness checks.
4357
"alive_topic": "ALIVE",
58+
# Enabled P2P clients (HTTP and/or P2P).
4459
"clients": ["http"],
60+
# Bootstrap peers for the P2P service.
4561
"peers": [
4662
"/dns/api1.aleph.im/tcp/4025/p2p/Qmaxufiqdyt5uVWcy1Xh2nh3Rs3382ArnSP2umjCiNG2Vs",
4763
"/dns/api2.aleph.im/tcp/4025/p2p/QmZkurbY2G2hWay59yiTgQNaQxHSNzKZFt2jbnwJhQcKgV",
4864
],
65+
# Topics to listen to by default on the P2P service.
4966
"topics": ["ALIVE", "ALEPH-TEST"],
5067
},
51-
"storage": {"folder": "/var/lib/pyaleph", "store_files": True, "engine": "filesystem"},
52-
"nuls": {
53-
"chain_id": 8964,
54-
"enabled": False,
55-
"packing_node": False,
56-
"private_key": None,
57-
"commit_delay": 14,
68+
"storage": {
69+
# Folder used to store files on the node.
70+
"folder": "/var/lib/pyaleph",
71+
# Whether to store files on the node.
72+
"store_files": True,
5873
},
5974
"nuls2": {
75+
# NULS2 chain ID.
6076
"chain_id": 1,
77+
# Whether to fetch transactions from NULS2.
6178
"enabled": False,
79+
# Whether to enable publishing of messages on NULS2 from this node.
6280
"packing_node": False,
81+
# NULS2 RPC node URL.
6382
"api_url": "https://apiserver.nuls.io/",
83+
# NULS2 explorer URL.
6484
"explorer_url": "https://nuls.world",
85+
# NULS2 private key. Only required if packing_node is set to true.
6586
"private_key": None,
87+
# Address of the aleph.im smart contract on NULS2.
6688
"sync_address": None,
89+
# Delay in seconds between publication attempts.
6790
"commit_delay": 14,
91+
# Remark filter for transactions.
6892
"remark": "ALEPH-SYNC",
69-
"token_contract": None,
7093
},
7194
"bsc": {
95+
# Whether to fetch transactions from the BSC chain.
7296
"enabled": True,
97+
# Address of the aleph.im smart contract on the BSC chain.
7398
"sync_contract": "0xdF270752C8C71D08acbae4372687DA65AECe2D5D",
7499
},
75100
"ethereum": {
101+
# Whether to fetch transactions from Ethereum.
76102
"enabled": False,
103+
# Ethereum RPC node URL.
77104
"api_url": "http://127.0.0.1:8545",
105+
# Whether to enable publishing of messages on Ethereum from this node.
78106
"packing_node": False,
107+
# Ethereum chain ID.
79108
"chain_id": 1,
109+
# Ethereum private key. Only required if packing_node is set to true.
80110
"private_key": None,
111+
# Address of the aleph.im smart contract on Ethereum.
81112
"sync_contract": None,
113+
# Ethereum block height to start from when fetching sync events.
82114
"start_height": 11400000,
115+
# Delay in seconds between publication attempts.
83116
"commit_delay": 35,
84-
"token_contract": None,
85-
"token_start_height": 10900000,
117+
# Maximum gas price accepted when publishing to Ethereum.
86118
"max_gas_price": 150000000000,
119+
# Authorized publishers for sync events.
87120
"authorized_emitters": ["0x23eC28598DCeB2f7082Cc3a9D670592DfEd6e0dC"],
88121
},
89122
"tezos": {
123+
# Whether to fetch transactions from Tezos.
90124
"enabled": True,
125+
# URL of the aleph.im indexer for Tezos.
91126
"indexer_url": "https://tezos-mainnet.api.aleph.cloud",
127+
# Address of the aleph.im smart contract on Tezos.
92128
"sync_contract": "KT1FfEoaNvooDfYrP61Ykct6L8z7w7e2pgnT",
93129
},
94130
"postgres": {
131+
# Hostname of the local PostgreSQL database.
95132
"host": "postgres",
133+
# Port of the local PostgreSQL database.
96134
"port": 5432,
135+
# Name of the database.
97136
"database": "aleph",
137+
# Username for the local PostgreSQL database.
98138
"user": "aleph",
139+
# Password for the local PostgreSQL database.
99140
"password": "decentralize-everything",
141+
# Maximum number of concurrent connections to the local PostgreSQL database.
100142
"pool_size": 50,
101143
},
102-
"mail": {
103-
"email_sender": "[email protected]",
104-
"smtp_url": "smtp://127.0.0.1",
105-
},
106144
"ipfs": {
145+
# Whether to enable storage and communication on IPFS.
107146
"enabled": True,
147+
# Hostname of the IPFS service.
108148
"host": "ipfs",
149+
# Port of the IPFS service.
109150
"port": 5001,
110-
"gateway_port": 8080,
111-
"id": None,
151+
# IPFS pubsub topic used for liveness checks.
112152
"alive_topic": "ALEPH_ALIVE",
153+
# Delay between connection attempts to other nodes on the network.
113154
"reconnect_delay": 60,
155+
# Bootstrap peers for IPFS.
114156
"peers": [
115157
"/dnsaddr/api1.aleph.im/ipfs/12D3KooWNgogVS6o8fVsPdzh2FJpCdJJLVSgJT38XGE1BJoCerHx",
116158
"/ip4/51.159.57.71/tcp/4001/p2p/12D3KooWBH3JVSBwHLNzxv7EzniBP3tDmjJaoa3EJBF9wyhZtHt2",
117159
"/ip4/62.210.93.220/tcp/4001/p2p/12D3KooWLcmvqojHzUnR7rr8YhFKGDD8z7fmsPyBfAm2rT3sFGAF",
118160
],
119161
},
120162
"rabbitmq": {
163+
# Hostname of the RabbitMQ service.
121164
"host": "rabbitmq",
165+
# Port of the RabbitMQ service.
122166
"port": 5672,
167+
# Username of the RabbitMQ service.
123168
"username": "aleph-p2p",
169+
# Password of the RabbitMQ service.
124170
"password": "change-me!",
171+
# Name of the exchange used to publish messages from the node to the P2P network.
125172
"pub_exchange": "p2p-publish",
173+
# Name of the exchange used to publish messages from the P2P network to the node.
126174
"sub_exchange": "p2p-subscribe",
175+
# Name of the exchange used to publish processed messages (output of the message processor).
127176
"message_exchange": "aleph-messages",
128177
},
129178
"redis": {
179+
# Hostname of the Redis service.
130180
"host": "redis",
181+
# Port of the Redis service.
131182
"port": 6379,
132183
},
133184
"sentry": {
185+
# Sentry DSN.
134186
"dsn": None,
187+
# Sentry trace sample rate.
135188
"traces_sample_rate": None,
136189
},
137190
}

src/aleph/services/ipfs/common.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ async def get_base_url(config):
88
return "http://{}:{}".format(config.ipfs.host.value, config.ipfs.port.value)
99

1010

11-
async def get_ipfs_gateway_url(config, hash):
12-
return "http://{}:{}/ipfs/{}".format(
13-
config.ipfs.host.value, config.ipfs.gateway_port.value, hash
14-
)
15-
1611

1712
def make_ipfs_client(config: Config, timeout: int = 60) -> aioipfs.AsyncIPFS:
1813
host = config.ipfs.host.value

0 commit comments

Comments
 (0)