mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(backend): Resolve Pydantic warning about missing secrets_dir (#8692)
- Remove `secrets_dir` and other references to `get_secrets_path()` - Remove unused `get_config_path()` Follow-up to #8521, which removed the `secrets` dir but not the references to it.
This commit is contained in:
committed by
GitHub
parent
6c109adf0b
commit
e840106949
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user