🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More
Socket
Book a DemoSign in
Socket

@ladjs/shared-config

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ladjs/shared-config - npm Package Compare versions

Comparing version
0.0.4
to
0.0.5
+26
-24
index.js
const fs = require('fs');
const Redis = require('ioredis');
const Redis = require('@ladjs/redis');
const env = process.env.NODE_ENV || 'development';
const isDev = env === 'development';
let rateLimit = {
duration: process.env.RATELIMIT_DURATION
? parseInt(process.env.RATELIMIT_DURATION, 10)
: 60000,
max: process.env.RATELIMIT_MAX
? parseInt(process.env.RATELIMIT_MAX, 10)
: 100,
id: ctx => ctx.ip,
prefix: process.env.RATELIMIT_PREFIX
? process.env.RATELIMIT_PREFIX
: `limit_${env.toLowerCase()}`
};
const rateLimit = isDev
? false
: {
duration: process.env.RATELIMIT_DURATION
? parseInt(process.env.RATELIMIT_DURATION, 10)
: 60000,
max: process.env.RATELIMIT_MAX
? parseInt(process.env.RATELIMIT_MAX, 10)
: 100,
id: ctx => ctx.ip,
prefix: process.env.RATELIMIT_PREFIX
? process.env.RATELIMIT_PREFIX
: `limit_${env.toLowerCase()}`
};
if (env === 'development') rateLimit = false;
const redisClient = new Redis({
showFriendlyErrorStack: env === 'development'
});
function sharedConfig(prefix) {

@@ -64,9 +61,14 @@ prefix = prefix.toUpperCase();

hookBeforeRoutes: false,
// <https://github.com/luin/ioredis>
// this is used for rate limiting and session storage (e.g. passport)
// we support ioredis which allows clustering, sentinels, etc
redisClient,
// <https://github.com/ladjs/store-ip-address>
storeIPAddress: {}
storeIPAddress: {},
// ioredis configuration object
// <https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options>
redis: {
showFriendlyErrorStack: isDev
}
};
// <https://github.com/luin/ioredis>
// this is used for rate limiting and session storage (e.g. passport)
// we support ioredis which allows clustering, sentinels, etc
config.redisClient = new Redis(config.redis, config.logger, isDev);
return config;

@@ -73,0 +75,0 @@ }

{
"name": "@ladjs/shared-config",
"description": "Shared configuration for Lad's API and Web servers",
"version": "0.0.4",
"version": "0.0.5",
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",

@@ -23,3 +23,3 @@ "ava": {

"dependencies": {
"ioredis": "^4.14.0"
"@ladjs/redis": "^1.0.0"
},

@@ -26,0 +26,0 @@ "devDependencies": {