Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8ee1ed97d
|
||
|
|
766027a49c
|
||
|
|
5726181f21
|
@@ -46,7 +46,7 @@ class Config(confini.Config):
|
|||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_args(cls, args, arg_flags=0x0f, env=os.environ, extra_args={}, base_config_dir=None, default_config_dir=None, user_config_dir=None, default_fee_limit=None, logger=None, load_callback=logcallback, dump_writer=sys.stdout):
|
def from_args(cls, args, arg_flags=0x0f, env=os.environ, extra_args={}, base_config_dir=None, default_config_dir=None, user_config_dir=None, default_fee_limit=None, logger=None, load_callback=None, dump_writer=sys.stdout):
|
||||||
"""Parses arguments in argparse.ArgumentParser instance, then match and override configuration values that match them.
|
"""Parses arguments in argparse.ArgumentParser instance, then match and override configuration values that match them.
|
||||||
|
|
||||||
The method processes all known argument flags from chainlib.cli.Flag passed in the "args" argument.
|
The method processes all known argument flags from chainlib.cli.Flag passed in the "args" argument.
|
||||||
|
|||||||
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
|
||||||
@@ -3,7 +3,7 @@ name=chainlib
|
|||||||
license=WTFPL2
|
license=WTFPL2
|
||||||
author_email=dev@holbrook.no
|
author_email=dev@holbrook.no
|
||||||
description=Generic blockchain access library and tooling
|
description=Generic blockchain access library and tooling
|
||||||
version=0.1.0
|
version=0.1.1
|
||||||
url=https://gitlab.com/chaintools/chainlib
|
url=https://gitlab.com/chaintools/chainlib
|
||||||
author=Louis Holbrook
|
author=Louis Holbrook
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user