fix: added conditional check for the unkey logger to reduce the number of logs (#25858)
This commit is contained in:
1 parent
a8f43da472
commit
550caa6665
1 file changed
+6
-1
@@ -28,11 +28,16 @@ export type RateLimitHelper = {
|
||||
|
||||
export const API_KEY_RATE_LIMIT = 30;
|
||||
|
||||
let warned = false;
|
||||
|
||||
export function rateLimiter() {
|
||||
const { UNKEY_ROOT_KEY } = process.env;
|
||||
|
||||
if (!UNKEY_ROOT_KEY) {
|
||||
log.warn("Disabled because the UNKEY_ROOT_KEY environment variable was not found.");
|
||||
if (!warned) {
|
||||
log.warn("Disabled because the UNKEY_ROOT_KEY environment variable was not found.");
|
||||
warned = true;
|
||||
}
|
||||
return () => ({ success: true, limit: 10, remaining: 999, reset: 0 } as RatelimitResponse);
|
||||
}
|
||||
const timeout = {
|
||||
|
||||
Reference in new issue
Block a user