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`.
pull/6461/head
Reinier van der Leer 2023-11-30 17:26:13 +01:00
parent ca6e9e5e34
commit 99fe114502
No known key found for this signature in database
GPG Key ID: CDC1180FDAE06193
1 changed files with 2 additions and 1 deletions

View File

@ -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
)