From 99fe114502230170cedd59fce9f6dbad2d3a4a02 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Thu, 30 Nov 2023 17:26:13 +0100 Subject: [PATCH] refactor: Make Agent Protocol server DB URL configurable - Refactor the `run_auto_gpt_server` function to make the Agent Protocol server database URL configurable. - Use the `os.getenv` method to retrieve the database URL from the environment variable `AP_SERVER_DB_URL`. --- autogpts/autogpt/autogpt/app/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autogpts/autogpt/autogpt/app/main.py b/autogpts/autogpt/autogpt/app/main.py index 8828d55e..5f626cde 100644 --- a/autogpts/autogpt/autogpt/app/main.py +++ b/autogpts/autogpt/autogpt/app/main.py @@ -2,6 +2,7 @@ import enum import logging import math +import os import re import signal import sys @@ -342,7 +343,7 @@ async def run_auto_gpt_server( config.plugins = scan_plugins(config) # Set up & start server - database = AgentDB("sqlite:///data/ap_server.db", debug_enabled=False) + database = AgentDB(os.getenv("AP_SERVER_DB_URL", "sqlite:///data/ap_server.db")) server = AgentProtocolServer( app_config=config, database=database, llm_provider=llm_provider )