Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ services:
mongodb:
container_name: mongodb
image: mongo:5.0.10
environment:
# To secure the root account, provide credentials here
MONGO_INITDB_ROOT_USERNAME:
MONGO_INITDB_ROOT_PASSWORD:
# To secure MongoDB, uncomment and set the following values
# environment:
# - MONGO_INITDB_DATABASE=admin
# - MONGO_INITDB_ROOT_USERNAME=admin
# - MONGO_INITDB_ROOT_PASSWORD=changeme
volumes:
- llmware-mongodb:/data/db
ports:
Expand Down
10 changes: 5 additions & 5 deletions llmware/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class LLMWareConfig:
"prompt_path_name": "prompt_history/",
"tmp_path_name": "tmp/"}

_conf = {"collection_db_uri": "mongodb://localhost:27017/",
"collection_db_username": "",
"collection_db_password": "",
_conf = {"collection_db_uri": os.environ.get("COLLECTION_DB_URI", "mongodb://localhost:27017/"),
"collection_db_username": "", # Not used for now
"collection_db_password": "", # Not used for now
"collection_db": "mongo",
"milvus_host": "localhost",
"milvus_port": 19530,
"milvus_host": os.environ.get("MILVUS_HOST","localhost"),
"milvus_port": int(os.environ.get("MILVUS_PORT",19530)),
"debug_mode": 0,
"llmware_sample_files_bucket": "llmware-sample-docs",
"llmware_public_models_bucket": "llmware-public-models",
Expand Down
9 changes: 2 additions & 7 deletions llmware/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@ class __DBManager:
def __init__(self):

self.collection_db_path = LLMWareConfig.get_config("collection_db_uri")
username = LLMWareConfig.get_config("collection_db_username")
password = LLMWareConfig.get_config("collection_db_password")

# default client is Mongo currently
self.client = MongoClient(self.collection_db_path, username=username, password=password,
unicode_decode_error_handler='ignore')
self.client = MongoClient(self.collection_db_path, unicode_decode_error_handler='ignore')
#self.client.admin.authenticate(username, password)

__instance = None
Expand All @@ -70,12 +67,10 @@ def __getattr__(self, item):

def check_db_uri(timeout_secs=5):

username = LLMWareConfig.get_config("collection_db_username")
password = LLMWareConfig.get_config("collection_db_password")
uri_string = LLMWareConfig.get_config("collection_db_uri")

# default client is Mongo currently
client = MongoClient(uri_string, username=username, password=password,unicode_decode_error_handler='ignore')
client = MongoClient(uri_string, unicode_decode_error_handler='ignore')

# self.client.admin.authenticate(username, password)

Expand Down