Skip to content

Commit d565e2d

Browse files
committed
web: Allow CASProvider config to be any source
By defining ``env`` in ``CASProvider``, the superclass implementation of ``is_configured`` requires the variables to be set in the actual environment. Configuration can come from reading in ``/run/secrets``, an ``.env`` file, or the environment. This commit defines our own ``is_configured`` that checks ``CONFIG`` for the needed variables instead of relying on the superclass. Additionally, add ``CHAINLIT_AUTH_SECRET`` to ``_NEEDS_ENVIRON``. Ref: AP-412
1 parent 2b84d21 commit d565e2d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

willa/config/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@
109109

110110

111111
_NEEDS_ENVIRON: list[str] = ['AWS_DEFAULT_REGION', 'AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY',
112-
'LANGFUSE_HOST', 'LANGFUSE_PUBLIC_KEY', 'LANGFUSE_SECRET_KEY']
112+
'LANGFUSE_HOST', 'LANGFUSE_PUBLIC_KEY', 'LANGFUSE_SECRET_KEY',
113+
'CHAINLIT_AUTH_SECRET']
113114
"""A list of configuration keys that need to be set in the environment as well."""
114115

115116
for key in _NEEDS_ENVIRON:

willa/web/cas_provider.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def __init__(self) -> None:
6666
'scope': 'openid profile berkeley_edu_groups',
6767
}
6868

69+
def is_configured(self) -> bool:
70+
return all(var in CONFIG for var in self.env)
71+
6972
async def get_token(self, code: str, url: str) -> str:
7073
request = {
7174
'client_id': self.client_id,

0 commit comments

Comments
 (0)