fix: update RateLimiter settings and load Discord webhook URL from environment
This commit is contained in:
@@ -54,7 +54,7 @@ class Misc(FastAPI):
|
|||||||
handler,
|
handler,
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
include_in_schema=True,
|
include_in_schema=True,
|
||||||
dependencies=[Depends(RateLimiter(times=10, seconds=2))],
|
dependencies=[Depends(RateLimiter(times=25, seconds=2))],
|
||||||
)
|
)
|
||||||
|
|
||||||
app.add_api_route(
|
app.add_api_route(
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ except ImportError:
|
|||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
# Discord webhook for notifications
|
# Discord webhook for notifications (load from environment)
|
||||||
DISCORD_WEBHOOK_URL = "https://discord.com/api/webhooks/1332864106750939168/6y6MgFhHLX0-BnL2M3hXnt2vJsue7Q2Duf_HjZenHNlNj7sxQr4lqxrPVJnJWf7KVAm2"
|
DISCORD_WEBHOOK_URL = os.getenv("DWH_URI", "")
|
||||||
|
|
||||||
# Configuration - using environment variables
|
# Configuration - using environment variables
|
||||||
PG_CONFIG = {
|
PG_CONFIG = {
|
||||||
@@ -496,13 +496,6 @@ async def fetch_latest_dump_info() -> Optional[Dict[str, Any]]:
|
|||||||
dumps.sort(key=lambda x: parse_date_safe(x.get("date", datetime.min)), reverse=True)
|
dumps.sort(key=lambda x: parse_date_safe(x.get("date", datetime.min)), reverse=True)
|
||||||
latest = dumps[0]
|
latest = dumps[0]
|
||||||
|
|
||||||
# Handle type issue with strftime
|
|
||||||
if isinstance(latest["date"], datetime):
|
|
||||||
formatted_date = latest["date"].strftime("%Y-%m-%d %H:%M:%S")
|
|
||||||
else:
|
|
||||||
formatted_date = "Unknown date"
|
|
||||||
|
|
||||||
print(f"Latest dump: {latest['filename']} ({formatted_date})")
|
|
||||||
return latest
|
return latest
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user