Skip to content

Commit

Permalink
init v5 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickmehaffy committed Jul 22, 2024
1 parent 320d922 commit 5857fdd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
save-exact=true
package-lock=false
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-redis",
"version": "1.1.0",
"version": "2.0.0",
"description": "Plugin used to centralize management of Redis connections in Strapi",
"strapi": {
"displayName": "Redis",
Expand All @@ -11,8 +11,11 @@
},
"dependencies": {
"chalk": "4.1.2",
"debug": "4.3.4",
"ioredis": "5.2.4"
"debug": "4.3.5",
"ioredis": "5.4.1"
},
"peerDependencies": {
"@strapi/strapi": "^5.0.0-rc.4"
},
"scripts": {},
"author": {
Expand Down
29 changes: 15 additions & 14 deletions server/register.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use strict'
'use strict';

const debug = require('debug')
const debug = require('debug');

module.exports = async ({ strapi }) => {
// Load plugin Config
const coreConfig = strapi.config.get('plugin.redis');

// Configure plugin debug
if (coreConfig.settings.debug === true) {
debug.enable('strapi:strapi-plugin-redis')
debug.enable('strapi:strapi-plugin-redis');
}

// Allow plugin + ioredis debug
if (coreConfig.settings.debug === true && coreConfig.settings.debugIORedis === true) {
debug.enable('strapi:strapi-plugin-redis,ioredis:*')
debug.enable('strapi:strapi-plugin-redis,ioredis:*');
}

// Construct Redis API
Expand All @@ -26,14 +26,15 @@ module.exports = async ({ strapi }) => {
await strapi.plugin('redis').service('connection').buildAll(coreConfig);

// Construct Admin Permissions
const actions = [
{
section: 'settings',
category: 'redis',
displayName: 'Access the Redis Overview page',
uid: 'settings.read',
pluginName: 'redis',
},
];
await strapi.admin.services.permission.actionProvider.registerMany(actions);
// Commenting this since it's not needed for now, there is no admin panel for this plugin
// const actions = [
// {
// section: 'settings',
// category: 'redis',
// displayName: 'Access the Redis Overview page',
// uid: 'settings.read',
// pluginName: 'redis',
// },
// ];
// await strapi.admin.services.permission.actionProvider.registerMany(actions);
};
4 changes: 2 additions & 2 deletions server/services/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = ({ strapi }) => ({
debug(`${chalk.red('Failed to build')} ${name} connection - ${chalk.blue('cluster')}`);
}

// Check for sentinel config
// Check for sentinel config
} else if (nameConfig.connection.sentinels) {
delete nameConfig.connection.host;
delete nameConfig.connection.port;
Expand All @@ -37,7 +37,7 @@ module.exports = ({ strapi }) => ({
debug(`${chalk.red('Failed to build')} ${name} connection - ${chalk.yellow('sentinel')}`);
}

// Check for regular single connection
// Check for regular single connection
} else {
try {
strapi.redis.connections[name] = {
Expand Down
21 changes: 14 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,21 @@ color-name@~1.1.4:
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==

debug@4.3.4, debug@^4.3.4:
debug@4.3.5:
version "4.3.5"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e"
integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==
dependencies:
ms "2.1.2"

debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
dependencies:
ms "2.1.2"

denque@^2.0.1:
denque@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1"
integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==
Expand All @@ -56,15 +63,15 @@ has-flag@^4.0.0:
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==

ioredis@5.2.4:
version "5.2.4"
resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.2.4.tgz#9e262a668bc29bae98f2054c1e0d7efd86996b96"
integrity sha512-qIpuAEt32lZJQ0XyrloCRdlEdUUNGG9i0UOk6zgzK6igyudNWqEBxfH6OlbnOOoBBvr1WB02mm8fR55CnikRng==
ioredis@5.4.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.4.1.tgz#1c56b70b759f01465913887375ed809134296f40"
integrity sha512-2YZsvl7jopIa1gaePkeMtd9rAcSjOOjPtpcLlOeusyO+XH2SK5ZcT+UCrElPP+WVIInh2TzeI4XW9ENaSLVVHA==
dependencies:
"@ioredis/commands" "^1.1.1"
cluster-key-slot "^1.1.0"
debug "^4.3.4"
denque "^2.0.1"
denque "^2.1.0"
lodash.defaults "^4.2.0"
lodash.isarguments "^3.1.0"
redis-errors "^1.2.0"
Expand Down

0 comments on commit 5857fdd

Please sign in to comment.