We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c79615 commit aa9eb7aCopy full SHA for aa9eb7a
slowapi/extension.py
@@ -6,6 +6,7 @@
6
import inspect
7
import itertools
8
import logging
9
+import os
10
import time
11
from datetime import datetime
12
from email.utils import formatdate, parsedate_to_datetime
@@ -154,8 +155,9 @@ def __init__(
154
155
156
self.logger = logging.getLogger("slowapi")
157
158
+ dotenv_file_exists = os.path.isfile(".env")
159
self.app_config = Config(
- config_filename if config_filename is not None else ".env"
160
+ ".env" if dotenv_file_exists and config_filename is None else config_filename
161
)
162
163
self.enabled = enabled
0 commit comments