Registry / database / ac-bootstrap-redis

ac-bootstrap-redis

JSON →
library1.0.10jsnpmunverified

Redis initialization module for AdmiralCloud (AC) applications. Version 1.0.10 provides parallel connection of multiple named Redis instances based on configuration, attaching them to the `acapi` object. It supports custom retry strategy, per-instance TLS, environment-based flushing, and options like timeout and auto-pipelining. Released under MIT, maintained by AdmiralCloud AG.

npm install ac-bootstrap-redis
INSTALL
IMPORT
SIG · AC-BOOTSTRAP-REDIS
A
ac-bootstrap-redis
databasejavascriptv1.0.10
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.

default
const initRedis = require('ac-bootstrap-redis')
import initRedis from 'ac-bootstrap-redis'
Package does not export ESM; use CommonJS require.
default
const initRedis = require('ac-bootstrap-redis')
const { initRedis } = require('ac-bootstrap-redis')
Module exports a single function as default, not as named export.
acapi.redis.<name>
acapi.redis.main
acapi.redis['main']
Instances are attached as direct properties of acapi.redis with the database name.

Demonstrates how to require and call initRedis with a mocked acapi object, configuring a local Redis server and a database, then using the resulting acapi.redis instance.

const initRedis = require('ac-bootstrap-redis') const acapi = { config: { environment: 'test', redis: { servers: [ { server: 'local', host: 'localhost', port: 6379 } ], databases: [ { name: 'main', server: 'local', db: 0 } ], connectTimeout: 10000 } } } ;(async () => { try { const logs = await initRedis(acapi, { bootstrapping: true, flushInTestmode: true }) console.log('Redis initialized:', logs) // Use acapi.redis.main } catch (err) { console.error('Initialization failed:', err) } })()
Debug
Known issues
gotchaThe module expects acapi.config.redis.databases to be an array with objects containing name, server, and db fields. Missing required fields will cause errors.
fix
Ensure each database object has at least name, server, and db properties.
affects: >=1.0.0
gotchaThe return value is an array of log entries, not a direct reference to Redis clients. To access clients, use acapi.redis.<name>.
fix
Access Redis instances via acapi.redis.<databaseName> instead of relying on the return value.
affects: >=1.0.0
gotchaIf bootstrapping is false and a connection fails, the process exits instead of throwing an error.
fix
Set bootstrapping: true to handle errors gracefully in non-production environments.
affects: >=1.0.0
gotchaThe flushInTestmode option only flushes databases when config.environment === 'test'. Using it with other environments has no effect.
fix
Ensure config.environment is set to 'test' if you want to flush databases.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'redis')
acapi.config.redis is not defined
fix
Set acapi.config.redis with at least servers and databases arrays before calling initRedis.
Error: Server not found for database main
The database references a server name that is not defined in servers array
fix
Ensure the database's server field matches a server's server field in the servers array.
Error: connect ECONNREFUSED 127.0.0.1:6379
Redis server is not running or unreachable
fix
Start a Redis server on the specified host and port, or update the configuration to point to an available instance.
Upgrade
Version history
1.0.10latest on npm
Audit
Dependencies
ioredisrequiredUsed for Redis client connections
Agent activity
50 hits · last 30 days
node
40
OpenAI (training)
2
Resources
ac-bootstrap-redis — npm install ac-bootstrap-redis · libregistry