Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(backend): Resolve Pydantic warning about missing `secrets_dir` (#8692)

Reinier van der Leere8401069493c
diff --git a/autogpt_platform/backend/backend/util/data.py b/autogpt_platform/backend/backend/util/data.py
index d9659623f7..d77d4cc789 100644
--- a/autogpt_platform/backend/backend/util/data.py
+++ b/autogpt_platform/backend/backend/util/data.py
@@ -3,14 +3,6 @@ import pathlib
import sys
-def get_secrets_path() -> pathlib.Path:
- return get_data_path() / "secrets"
-
-
-def get_config_path() -> pathlib.Path:
- return get_data_path()
-
-
def get_frontend_path() -> pathlib.Path:
if getattr(sys, "frozen", False):
# The application is frozen
diff --git a/autogpt_platform/backend/backend/util/settings.py b/autogpt_platform/backend/backend/util/settings.py
index 6ac528fef0..7383c3d105 100644
--- a/autogpt_platform/backend/backend/util/settings.py
+++ b/autogpt_platform/backend/backend/util/settings.py
@@ -11,7 +11,7 @@ from pydantic_settings import (
SettingsConfigDict,
)
-from backend.util.data import get_data_path, get_secrets_path
+from backend.util.data import get_data_path
T = TypeVar("T", bound=BaseSettings)
@@ -272,7 +272,6 @@ class Secrets(UpdateTrackingModel["Secrets"], BaseSettings):
# Add more secret fields as needed
model_config = SettingsConfigDict(
- secrets_dir=get_secrets_path(),
env_file=".env",
env_file_encoding="utf-8",
extra="allow",
@@ -299,11 +298,3 @@ class Settings(BaseModel):
with open(config_path, "w") as f:
json.dump(config_to_save, f, indent=2)
self.config.clear_updates()
-
- # Save updated secrets to individual files
- secrets_dir = get_secrets_path()
- for key in self.secrets.updated_fields:
- secret_file = os.path.join(secrets_dir, key)
- with open(secret_file, "w") as f:
- f.write(str(getattr(self.secrets, key)))
- self.secrets.clear_updates()