Registry / email / haraka-plugin-redis

haraka-plugin-redis

JSON →
library2.1.0jsnpmunverified

Haraka SMTP server plugin for connecting to Redis instances. Version 2.1.0 provides shared Redis connections stored at server.notes.redis, with optional separate pub/sub connections and per-plugin Redis connections via inheritance. Supports configurable databases, password, and custom options. Updated infrequently, primarily for Haraka plugin ecosystem.

npm install haraka-plugin-redis
INSTALL
IMPORT
SIG · HARAKA-PLUGIN-REDI
H
haraka-plugin-redis
emailjavascriptv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

haraka-plugin-redis
this.inherits('redis') // within a Haraka plugin
const redis = require('haraka-plugin-redis')
This is a Haraka plugin, not a standalone module. Use inheritance in your Haraka plugin.
server.notes.redis
if (server.notes.redis) { server.notes.redis.hGetAll(...) }
server.notes.redis = require('redis').createClient()
Shared Redis handle is automatically set by the plugin. Do not manually create your own.
register_hook('init_master', ...)
this.register_hook('init_master', 'init_redis_plugin')
this.register_hook('init_master', this.init_redis_plugin)
The hook callback is specified as a string (method name), not a function reference.

Demonstrates inheriting the redis plugin, registering init hooks, and using the shared Redis client in a hook.

// In your Haraka plugin file (e.g., my-plugin.js) exports.register = function () { this.inherits('redis') this.register_hook('init_master', 'init_redis_plugin') this.register_hook('init_child', 'init_redis_plugin') } exports.hook_rcpt = function (next, connection) { if (connection.server.notes.redis) { connection.server.notes.redis.hGetAll('somekey', function (err, data) { if (err) return next() // process data next() }) } else { next() } }
Debug
Known issues
gotchaRedis connections are not closed automatically on plugin disable or restart.
fix
Manually quit Redis in hook_disconnect or plugin shutdown handler.
affects: >=1.0.0
gotchaThe 'redis' plugin must be loaded before any plugin that inherits it in config/plugins.
fix
Ensure 'redis' appears before your plugin in config/plugins file.
affects: >=1.0.0
gotchaServer.notes.redis may be undefined if Redis connection fails.
fix
Always check if server.notes.redis exists before using it.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'hGetAll')
server.notes.redis is undefined because Redis connection is not yet established or failed.
fix
Ensure redis plugin is loaded and wait for init_child hook before using redis in hooks.
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server is not running or unreachable.
fix
Start Redis server or check redis.ini configuration for correct host/port.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
harakarequiredCore SMTP server that this plugin extends
redisrequiredNode.js Redis client library
Agent activity
13 hits · last 30 days
node
12
Resources
haraka-plugin-redis — npm install haraka-plugin-redis · libregistry