with open(filename, 'r') as f:
config.readfp(f)
except IOError:
- print "Could not read %s. Falling back." % filename
+ pass
def create_config():
config = ConfigParser.ConfigParser()
config.set('database', 'database', 'abe')
config.set('server', 'backend', 'abe')
- for path in ('', '/etc/'):
+ for path in ('/etc/', ''):
filename = path + 'electrum.conf'
attempt_read_config(config, filename)
# NativeServer cannot be used with libbitcoin
native_port = None
config.set('server', 'native_port', '')
- from modules.python_bitcoin import BlockchainProcessor
- elif backend_name == "abe":
- from modules.abe import AbeProcessor as BlockchainProcessor
- else:
+ try:
+ backend = __import__("modules." + backend_name,
+ fromlist=["BlockchainProcessor"])
+ except ImportError:
sys.stderr.write('Unknown backend specified\n')
sys.exit(-1)
shared = dispatcher.shared
# Create and register processors
- chain_proc = BlockchainProcessor(config)
+ chain_proc = backend.BlockchainProcessor(config)
dispatcher.register('blockchain', chain_proc)
server_proc = ServerProcessor(config)