Add settings module
This commit is contained in:
parent
5726181f21
commit
766027a49c
26
chainlib/settings.py
Normal file
26
chainlib/settings.py
Normal 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
|
Loading…
Reference in New Issue
Block a user