use native fetch and refactored list creation

This commit is contained in:
Viet Huynh
2023-09-09 19:53:47 +07:00
parent f7f9001ec5
commit 43bd87f2dd
5 changed files with 126 additions and 81 deletions
+25
View File
@@ -0,0 +1,25 @@
import { isDev } from "./utils.js";
if (isDev()) {
const dotenv = await import("dotenv");
dotenv.config();
}
export const API_TOKEN = process.env.CLOUDFLARE_API_KEY;
export const ACCOUNT_ID = process.env.CLOUDFLARE_ACCOUNT_ID;
export const ACCOUNT_EMAIL = process.env.CLOUDFLARE_ACCOUNT_EMAIL;
export const LIST_ITEM_LIMIT = isNaN(process.env.CLOUDFLARE_LIST_ITEM_LIMIT)
? 300000
: parseInt(process.env.CLOUDFLARE_LIST_ITEM_LIMIT, 10);
export const LIST_ITEM_SIZE = 1000;
export const API_HOST = "https://api.cloudflare.com/client/v4";
export const DRY_RUN = !!parseInt(process.env.DRY_RUN, 10);
export const FAST_MODE = !!parseInt(process.env.FAST_MODE, 10);