Skip to content

Commit 6930846

Browse files
committed
Fix OAuth2Strategy, raise KeyError when get_setting is not providing a value
1 parent 307bef0 commit 6930846

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/fastapi_oauth2/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ def absolute_uri(self, path=None) -> str:
3535

3636
def get_setting(self, name) -> Any:
3737
""" settings from environment """
38-
return os.getenv(name, '')
38+
value = os.getenv(name)
39+
if value == None:
40+
raise KeyError
41+
return value
3942

4043
@staticmethod
4144
def get_json(url, method='GET', *args, **kwargs) -> httpx.Response:

0 commit comments

Comments
 (0)