Add settings module

This commit is contained in:
lash 2022-04-28 12:31:11 +00:00
parent 5726181f21
commit 766027a49c
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

26
chainlib/settings.py Normal file
View File

@ -0,0 +1,26 @@
# local imports
from .chain import ChainSpec
class ChainSettings:
def __init__(self, include_sync=False, include_queue=False):
self.o = {}
self.get = self.o.get
def process_common(self, config):
self.o['CHAIN_SPEC'] = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
def process(self, config):
self.process_common(config)
def __str__(self):
ks = list(self.o.keys())
ks.sort()
s = ''
for k in ks:
s += '{}: {}\n'.format(k, self.o.get(k))
return s