Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 18, 2024
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
8 changes: 0 additions & 8 deletions autogpt_platform/backend/backend/util/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
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
Expand Down
11 changes: 1 addition & 10 deletions autogpt_platform/backend/backend/util/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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)

Expand Down Expand Up @@ -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",
Expand All @@ -299,11 +298,3 @@ def save(self) -> None:
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()
Loading