Skip to content

Commit fb7b07f

Browse files
committed
make sure the pg connstring is correct for cv2:// instances
1 parent 1d21306 commit fb7b07f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

controller/CV2.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ CV2::CV2(const Identity &myId, const char *path, int listenPort)
4949
{
5050
char myAddress[64];
5151
_myAddressStr = myId.address().toString(myAddress);
52-
_connString = std::string(path);
52+
53+
// replace cv2: with postgres: for the path/connstring
54+
std::string _path(path);
55+
if (_path.length() > 4 && _path.substr(0, 4) == "cv2:") {
56+
_path = "postgres:" + _path.substr(4);
57+
}
58+
_connString = std::string(_path);
59+
5360
auto f = std::make_shared<PostgresConnFactory>(_connString);
5461
_pool = std::make_shared<ConnectionPool<PostgresConnection> >(
5562
15, 5, std::static_pointer_cast<ConnectionFactory>(f));

0 commit comments

Comments
 (0)