forked from hyperledger-iroha/iroha-dco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_config.py
36 lines (25 loc) · 896 Bytes
/
generate_config.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
import optparse
from pathlib import Path
home = str(Path.home())
parser = optparse.OptionParser()
parser.add_option('-p', '--postgres-password',
help="postgress password")
parser.add_option('-u', '--postgres-user',
help="postgress user")
options, args = parser.parse_args()
if not options.postgres_password or not options.postgres_user:
raise ValueError("No user or pass provided")
with open(home+"/iroha_data/config.sample", "w") as f:
s = """{{
"block_store_path" : "/tmp/block_store/",
"torii_port" : 50051,
"internal_port" : 10001,
"pg_opt" : "host=iroha_postgres port=5432 user={} password={}",
"redis_host" : "iroha_redis",
"redis_port" : 6379,
"max_proposal_size" : 10,
"proposal_delay" : 5000,
"vote_delay" : 5000,
"load_delay" : 5000
}}""".format(options.postgres_user, options.postgres_password)
f.write(s)