Skip to content

Commit 1f34928

Browse files
authored
Merge pull request #11 from misamoylov/add_host_to_node_method
Add providing ipaddress to NodeConnection.
2 parents 1e41f4d + 211a9f3 commit 1f34928

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

testgres/testgres.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,16 @@ class NodeConnection(object):
7070
Transaction wrapper returned by Node
7171
"""
7272

73-
def __init__(self, parent_node, dbname):
73+
def __init__(self, parent_node, dbname, host="127.0.0.1", user=None, password=None):
7474
self.parent_node = parent_node
75-
75+
if user is None:
76+
user = get_username()
7677
self.connection = pglib.connect(
7778
database=dbname,
78-
user=get_username(),
79+
user=user,
7980
port=parent_node.port,
80-
host="127.0.0.1"
81+
host=host,
82+
password=password
8183
)
8284

8385
self.cursor = self.connection.cursor()

0 commit comments

Comments
 (0)