mirror of
https://github.com/Nezumi-2711/cloudflare-gateway-pihole-scripts.git
synced 2026-09-22 13:38:37 +00:00
throw error if required secrets have not been added
This commit is contained in:
@@ -20,6 +20,12 @@ if (!globalThis.fetch) {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
const request = async (url, options) => {
|
const request = async (url, options) => {
|
||||||
|
if (!API_TOKEN || !ACCOUNT_ID || !ACCOUNT_EMAIL) {
|
||||||
|
throw new Error(
|
||||||
|
"One or more required secrets have not been added: CLOUDFLARE_API_KEY, CLOUDFLARE_ACCOUNT_ID, and CLOUDFLARE_ACCOUNT_EMAIL"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${API_TOKEN}`,
|
Authorization: `Bearer ${API_TOKEN}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user