mirror of
https://github.com/laurentS/slowapi.git
synced 2026-03-13 09:10:20 +08:00
fix: only pass .env to config if it exists
This commit is contained in:
@@ -6,6 +6,7 @@ import functools
|
||||
import inspect
|
||||
import itertools
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
from datetime import datetime
|
||||
from email.utils import formatdate, parsedate_to_datetime
|
||||
@@ -154,8 +155,9 @@ class Limiter:
|
||||
|
||||
self.logger = logging.getLogger("slowapi")
|
||||
|
||||
dotenv_file_exists = os.path.isfile(".env")
|
||||
self.app_config = Config(
|
||||
config_filename if config_filename is not None else ".env"
|
||||
".env" if dotenv_file_exists and config_filename is None else config_filename
|
||||
)
|
||||
|
||||
self.enabled = enabled
|
||||
|
||||
Reference in New Issue
Block a user