I'm quite a newbie, I know angular but still learning nestjs, so please forgive me if what I say seems silly.
My nestjs app uses redis.
Locally (redis installed via homebrew) the app goes up.
Then I installed redis remotely in a docker instance and configured my local environment towards that redis instance: so far so good (obviously a "redis-cli ping" gets pong as response).
Then I dockerised my nestjs app and published in the same docker as redis. The configuration is the same as my local environment and the redis configuration is pointing to the docker host ip (not localhost or 127.0.0.1).
I get:
[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
this:
export const RedisSettings: RedisOptions = {
host: process.env.REDIS_HOST || 'localhost',
port: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT, 10) : 6379,
};
and this:
const bootstrap = async () => {
### this log prints the right values ###
console.log(green(`Redis on ${ process.env.REDIS_HOST }:${
process.env.REDIS_PORT }`));
const app = await NestFactory.create(AppModule, {
logger: ['error', 'warn', 'log', 'debug', 'verbose'],
});
app.enableCors();
const staticPath = join(process.cwd(), '_html/');
app.use(express.static(staticPath));
const port = process.env.PORT || 3000;
await app.listen(port);
console.log(cyan(`\n\nServing on http://localhost:${ port }`));
};
void bootstrap();
any hint?