Skip to content
Merged
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
14 changes: 13 additions & 1 deletion a2a/slack_researcher/slack_researcher/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@


class Settings(BaseSettings):
# static path for client secret file
secret_file_path: str = "/shared/secret.txt"

LOG_LEVEL: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] = Field(
os.getenv("LOG_LEVEL", "DEBUG"),
description="Application log level",
Expand Down Expand Up @@ -60,7 +63,7 @@ class Settings(BaseSettings):
description="Client ID to authenticate to OAuth server"
)
CLIENT_SECRET: Optional[str] = Field(
os.getenv("CLIENT_SECRET", None),
None,
description="Client secret to authenticate to OAuth server"
)
TARGET_AUDIENCE: Optional[str] = Field(
Expand All @@ -84,6 +87,15 @@ def validate_extra_headers(self) -> "Settings":
except json.JSONDecodeError:
raise ValueError("EXTRA_HEADERS must be a valid JSON string")

# --- Load CLIENT_SECRET from file ---
try:
with open(self.secret_file_path, "r") as f:
self.CLIENT_SECRET = f.read().strip()
except FileNotFoundError:
logging.warning(f"CLIENT_SECRET file not found at {self.secret_file_path}")
except Exception as e:
logging.error(f"Error reading CLIENT_SECRET file: {e}")

return self

settings = Settings() # type: ignore[call-arg]