UNPKG

@aikidosec/firewall

Version:

Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.

20 lines (19 loc) 651 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getConfig = getConfig; const fetch_1 = require("../../helpers/fetch"); const getAPIURL_1 = require("../getAPIURL"); async function getConfig(token) { const { body, statusCode } = await (0, fetch_1.fetch)({ url: new URL(`${(0, getAPIURL_1.getAPIURL)().toString()}api/runtime/config`), method: "GET", headers: { Authorization: token.asString(), }, timeoutInMS: 3000, }); if (statusCode !== 200) { throw new Error(`Invalid response (${statusCode}): ${body}`); } return JSON.parse(body); }