21 lines
432 B
Python
21 lines
432 B
Python
import os
|
|
from rethinkdb import RethinkDB
|
|
|
|
rethinkUrl = os.environ.get('RETHINKDB_URL')
|
|
rethinkPort = os.environ.get('RETHINKDB_PORT')
|
|
rethinkdb = "finfree"
|
|
|
|
r = RethinkDB()
|
|
|
|
connection = None
|
|
|
|
def get_connection():
|
|
global connection
|
|
if connection is None or not connection.is_open():
|
|
connection = r.connect(rethinkUrl, rethinkPort, db=rethinkdb)
|
|
|
|
return connection
|
|
|
|
def getRethinkDB():
|
|
global r
|
|
return r |