settings.py (1247B)
1 # external imports 2 from chainlib.eth.connection import EthHTTPConnection 3 from chainlib.eth.settings import process_settings as base_process_settings 4 from chaind.eth.chain import EthChainInterface 5 from chaind.settings import * 6 from chainsyncer.settings import process_sync_range 7 8 9 def process_common(settings, config): 10 rpc_provider = config.get('RPC_PROVIDER') 11 if rpc_provider == None: 12 rpc_provider = 'http://localhost:8545' 13 conn = EthHTTPConnection(url=rpc_provider, chain_spec=settings.get('CHAIN_SPEC')) 14 settings.set('RPC', conn) 15 return settings 16 17 18 def process_sync(settings, config): 19 dialect_filter = settings.get('RPC_DIALECT_FILTER') 20 settings.set('SYNCER_INTERFACE', EthChainInterface(dialect_filter=dialect_filter)) 21 #settings.set('SYNCER_INTERFACE', EthChainInterface()) 22 settings = process_sync_range(settings, config) 23 return settings 24 25 26 def process_settings(settings, config): 27 settings = base_process_settings(settings, config) 28 settings = process_common(settings, config) 29 settings = process_backend(settings, config) 30 settings = process_session(settings, config) 31 settings = process_socket(settings, config) 32 settings = process_token(settings, config) 33 34 return settings