Skip to content

Commit 0c30cec

Browse files
Vector DB secure connections (#77)
* Add SSL enable for Postgres * Remove logger * Add a description
1 parent a424e5b commit 0c30cec

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/unstract/sdk/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
__version__ = "0.39.0"
2-
1+
__version__ = "0.40.0"
32

43

54
def get_sdk_version():

src/unstract/sdk/adapters/vectordb/postgres/src/postgres.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Constants:
2020
PORT = "port"
2121
USER = "user"
2222
SCHEMA = "schema"
23+
ENABLE_SSL = "enable_ssl"
2324

2425

2526
class Postgres(VectorDBAdapter):
@@ -82,12 +83,17 @@ def _get_vector_db_instance(self) -> BasePydanticVectorStore:
8283
table_name=self._collection_name,
8384
embed_dim=dimension,
8485
)
86+
if self._config.get(Constants.ENABLE_SSL, True):
87+
ssl_mode = "require"
88+
else:
89+
ssl_mode = "disable"
8590
self._client = psycopg2.connect(
8691
database=self._config.get(Constants.DATABASE),
8792
host=self._config.get(Constants.HOST),
8893
user=self._config.get(Constants.USER),
8994
password=self._config.get(Constants.PASSWORD),
9095
port=str(self._config.get(Constants.PORT)),
96+
sslmode=ssl_mode,
9197
)
9298

9399
return vector_db

src/unstract/sdk/adapters/vectordb/postgres/src/static/json_schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
"title": "Password",
4242
"format": "password",
4343
"default": ""
44+
},
45+
"enable_ssl": {
46+
"type": "boolean",
47+
"title": "Enable SSL",
48+
"description": "On selecting the checkbox, data encryption using SSL is enabled",
49+
"default": true
4450
}
4551
}
4652
}

0 commit comments

Comments
 (0)