axios-cached-dns-resolve
Advanced tools
Comparing version
@@ -96,4 +96,4 @@ import { serial as test } from 'ava' | ||
t.is(1, axiosCachingDns.config.cache.length) | ||
await delay(1000) | ||
await delay(2000) | ||
t.is(0, axiosCachingDns.config.cache.length) | ||
}) |
@@ -47,2 +47,3 @@ 'use strict'; | ||
var config = exports.config = { | ||
disabled: process.env.AXIOS_DNS_DISABLE === 'true', | ||
dnsTtlMs: process.env.AXIOS_DNS_CACHE_TTL_MS || 5000, // when to refresh actively used dns entries (5 sec) | ||
@@ -115,3 +116,3 @@ cacheGraceExpireMultiplier: process.env.AXIOS_DNS_CACHE_EXPIRE_MULTIPLIER || 2, // maximum grace to use entry beyond TTL | ||
function registerInterceptor(axios) { | ||
if (!axios || !axios.interceptors) return; // supertest | ||
if (config.disabled || !axios || !axios.interceptors) return; // supertest | ||
axios.interceptors.request.use(async function (reqConfig) { | ||
@@ -118,0 +119,0 @@ var url = void 0; |
@@ -14,2 +14,3 @@ import dns from 'dns' | ||
export const config = { | ||
disabled: process.env.AXIOS_DNS_DISABLE === 'true', | ||
dnsTtlMs: process.env.AXIOS_DNS_CACHE_TTL_MS || 5000, // when to refresh actively used dns entries (5 sec) | ||
@@ -78,3 +79,3 @@ cacheGraceExpireMultiplier: process.env.AXIOS_DNS_CACHE_EXPIRE_MULTIPLIER || 2, // maximum grace to use entry beyond TTL | ||
export function registerInterceptor(axios) { | ||
if (!axios || !axios.interceptors) return // supertest | ||
if (config.disabled || !axios || !axios.interceptors) return // supertest | ||
axios.interceptors.request.use(async (reqConfig) => { | ||
@@ -81,0 +82,0 @@ let url |
{ | ||
"name": "axios-cached-dns-resolve", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Caches dns resolutions made with async dns.resolve instead of default sync dns.lookup, refreshes in background", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -53,2 +53,3 @@ # axios-cached-dns-resolve | ||
const config = { | ||
disabled: process.env.AXIOS_DNS_DISABLE === "true", | ||
dnsTtlMs: process.env.AXIOS_DNS_CACHE_TTL_MS || 5000, // when to refresh actively used dns entries (5 sec) | ||
@@ -55,0 +56,0 @@ cacheGraceExpireMultiplier: process.env.AXIOS_DNS_CACHE_EXPIRE_MULTIPLIER || 2, // maximum grace to use entry beyond TTL |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
21318
0.95%412
0.49%70
1.45%14
16.67%