mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Pass db params to get_backend
This commit is contained in:
parent
14bf1fff5e
commit
51db5ab190
@ -62,7 +62,7 @@ class Bigchain(object):
|
|||||||
self.host = host or bigchaindb.config['database']['host']
|
self.host = host or bigchaindb.config['database']['host']
|
||||||
self.port = port or bigchaindb.config['database']['port']
|
self.port = port or bigchaindb.config['database']['port']
|
||||||
self.dbname = dbname or bigchaindb.config['database']['name']
|
self.dbname = dbname or bigchaindb.config['database']['name']
|
||||||
self.backend = backend or get_backend()
|
self.backend = backend or get_backend(host, port, dbname)
|
||||||
self.me = public_key or bigchaindb.config['keypair']['public']
|
self.me = public_key or bigchaindb.config['keypair']['public']
|
||||||
self.me_private = private_key or bigchaindb.config['keypair']['private']
|
self.me_private = private_key or bigchaindb.config['keypair']['private']
|
||||||
self.nodes_except_me = keyring or bigchaindb.config['keyring']
|
self.nodes_except_me = keyring or bigchaindb.config['keyring']
|
||||||
|
@ -67,16 +67,16 @@ class Connection:
|
|||||||
time.sleep(2**i)
|
time.sleep(2**i)
|
||||||
|
|
||||||
|
|
||||||
def get_backend():
|
def get_backend(host=None, port=None, db=None):
|
||||||
'''Get a backend instance.'''
|
'''Get a backend instance.'''
|
||||||
|
|
||||||
from bigchaindb.db.backends import rethinkdb
|
from bigchaindb.db.backends import rethinkdb
|
||||||
|
|
||||||
# NOTE: this function will be re-implemented when we have real
|
# NOTE: this function will be re-implemented when we have real
|
||||||
# multiple backends to support. Right now it returns the RethinkDB one.
|
# multiple backends to support. Right now it returns the RethinkDB one.
|
||||||
return rethinkdb.RethinkDBBackend(host=bigchaindb.config['database']['host'],
|
return rethinkdb.RethinkDBBackend(host=host or bigchaindb.config['database']['host'],
|
||||||
port=bigchaindb.config['database']['port'],
|
port=port or bigchaindb.config['database']['port'],
|
||||||
db=bigchaindb.config['database']['name'])
|
db=db or bigchaindb.config['database']['name'])
|
||||||
|
|
||||||
|
|
||||||
def get_conn():
|
def get_conn():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user