Add warnings regarding memory store

This commit is contained in:
William Easton 2025-10-10 12:30:27 -04:00
commit d1f7c74cde
No known key found for this signature in database
2 changed files with 16 additions and 0 deletions

View file

@ -191,6 +191,14 @@ class OAuth(OAuthClientProvider):
# Create server-specific token storage
token_storage = token_storage or MemoryStore()
if isinstance(token_storage, MemoryStore):
from warnings import warn
warn(
message="Using in-memory token storage is not recommended for production use -- "
+ "tokens will be lost on server restart."
)
self.token_storage_adapter: TokenStorageAdapter = TokenStorageAdapter(
async_key_value=token_storage, server_url=server_base_url
)

View file

@ -388,6 +388,14 @@ class OAuthProxy(OAuthProvider):
self._client_storage: AsyncKeyValue = client_storage or MemoryStore()
if isinstance(self._client_storage, MemoryStore):
from warnings import warn
warn(
message="Using in-memory client storage is not recommended for production use -- "
+ "clients will be lost on server restart which may require manual clean-up of oauth information on the client."
)
self._client_store = PydanticAdapter[ProxyDCRClient](
key_value=self._client_storage,
pydantic_model=ProxyDCRClient,