mirror of
https://github.com/Nezumi-2711/cloudflare-gateway-pihole-scripts.git
synced 2026-09-22 13:38:37 +00:00
use API Token in favour of API Key for better security
This commit is contained in:
+11
-4
@@ -2,7 +2,15 @@ import dotenv from "dotenv";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
export const API_TOKEN = process.env.CLOUDFLARE_API_KEY;
|
||||
if (process.env.CLOUDFLARE_API_KEY) {
|
||||
console.warn(
|
||||
"Using Global API Key is very risky for your Cloudflare account. It is strongly recommended to create an API Token with scoped permissions instead."
|
||||
);
|
||||
}
|
||||
|
||||
export const API_KEY = process.env.CLOUDFLARE_API_KEY;
|
||||
|
||||
export const API_TOKEN = process.env.CLOUDFLARE_API_TOKEN;
|
||||
|
||||
export const ACCOUNT_ID = process.env.CLOUDFLARE_ACCOUNT_ID;
|
||||
|
||||
@@ -33,12 +41,11 @@ export const LIST_TYPE = {
|
||||
};
|
||||
|
||||
export const USER_DEFINED_ALLOWLIST_URLS = process.env.ALLOWLIST_URLS
|
||||
// .filter(x => x) removes empty items from the URL arrays
|
||||
? process.env.ALLOWLIST_URLS.split("\n").filter(x => x)
|
||||
? process.env.ALLOWLIST_URLS.split("\n").filter((x) => x)
|
||||
: undefined;
|
||||
|
||||
export const USER_DEFINED_BLOCKLIST_URLS = process.env.BLOCKLIST_URLS
|
||||
? process.env.BLOCKLIST_URLS.split("\n").filter(x => x)
|
||||
? process.env.BLOCKLIST_URLS.split("\n").filter((x) => x)
|
||||
: undefined;
|
||||
|
||||
export const RECOMMENDED_ALLOWLIST_URLS = [
|
||||
|
||||
Reference in New Issue
Block a user