mirror of
https://github.com/BreizhHardware/Jellystat.git
synced 2026-01-18 16:27:20 +01:00
Implement DNS Caching with cacheable-lookup
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
const axios = require("axios");
|
||||
const https = require('https');
|
||||
const CacheableLookup = require('cacheable-lookup');
|
||||
|
||||
const cacheable = new CacheableLookup();
|
||||
|
||||
const agent = new https.Agent({
|
||||
rejectUnauthorized: (process.env.REJECT_SELF_SIGNED_CERTIFICATES || 'true').toLowerCase() ==='true'
|
||||
});
|
||||
rejectUnauthorized: (process.env.REJECT_SELF_SIGNED_CERTIFICATES || 'true').toLowerCase() === 'true'
|
||||
});
|
||||
|
||||
cacheable.install(agent);
|
||||
|
||||
const axios_instance = axios.create({
|
||||
httpsAgent: agent
|
||||
});
|
||||
httpsAgent: agent
|
||||
});
|
||||
|
||||
module.exports =
|
||||
{
|
||||
axios:axios_instance
|
||||
};
|
||||
|
||||
module.exports =
|
||||
{
|
||||
axios: axios_instance
|
||||
};
|
||||
|
||||
9
package-lock.json
generated
9
package-lock.json
generated
@@ -20,6 +20,7 @@
|
||||
"axios": "^1.5.1",
|
||||
"axios-cache-interceptor": "^1.3.1",
|
||||
"bootstrap": "^5.2.3",
|
||||
"cacheable-lookup": "^7.0.0",
|
||||
"compare-versions": "^6.0.0-rc.1",
|
||||
"compression": "^1.7.4",
|
||||
"config": "^3.3.9",
|
||||
@@ -7346,6 +7347,14 @@
|
||||
"resolved": "https://registry.npmjs.org/cache-parser/-/cache-parser-1.2.4.tgz",
|
||||
"integrity": "sha512-O0KwuHuJnbHUrghHi2kGp0SxnWSIBXTYt7M8WVhW0kbPRUNUKoE/Of6e1rRD6AAxmfxFunKnt90yEK09D+sc5g=="
|
||||
},
|
||||
"node_modules/cacheable-lookup": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz",
|
||||
"integrity": "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==",
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz",
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"axios": "^1.5.1",
|
||||
"axios-cache-interceptor": "^1.3.1",
|
||||
"bootstrap": "^5.2.3",
|
||||
"cacheable-lookup": "^7.0.0",
|
||||
"compare-versions": "^6.0.0-rc.1",
|
||||
"compression": "^1.7.4",
|
||||
"config": "^3.3.9",
|
||||
|
||||
Reference in New Issue
Block a user