mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-18 13:04:14 +02:00
Allow redis to use password auth
This commit is contained in:
parent
bc7f2ffcfd
commit
9ebf8a6938
@ -10,8 +10,11 @@ POSTGRES_USER=USERNAME
|
|||||||
POSTGRES_PASSWORD=PASSWORD
|
POSTGRES_PASSWORD=PASSWORD
|
||||||
POSTGRES_DB=DB
|
POSTGRES_DB=DB
|
||||||
|
|
||||||
# Redis
|
# Redis (if running everything within docker compose, use "redis" for the host and leave the rest empty)
|
||||||
REDIS_URL= # URL to redis database (if running everything within docker compose, use "redis")
|
REDIS_HOST= # URL to redis database
|
||||||
|
REDIS_USER= # redis database user
|
||||||
|
REDIS_PASSWORD= # redis database password
|
||||||
|
REDIS_PORT= # redis database port
|
||||||
|
|
||||||
# Database URL (designed for Postgres, but designed on Prisma)
|
# Database URL (designed for Postgres, but designed on Prisma)
|
||||||
DATABASE_URL= # "postgresql://USERNAME:PASSWORD@postgres:5432/DB?schema=ara&sslmode=prefer"
|
DATABASE_URL= # "postgresql://USERNAME:PASSWORD@postgres:5432/DB?schema=ara&sslmode=prefer"
|
||||||
|
16
src/index.ts
16
src/index.ts
@ -27,6 +27,10 @@ import '@sapphire/plugin-logger/register';
|
|||||||
import { PrismaClient } from '@prisma/client';
|
import { PrismaClient } from '@prisma/client';
|
||||||
import { Redis } from 'ioredis';
|
import { Redis } from 'ioredis';
|
||||||
|
|
||||||
|
const REDIS_PORT = process.env.REDIS_PORT
|
||||||
|
? parseInt(process.env.REDIS_PORT)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
// Setting up the Sapphire client
|
// Setting up the Sapphire client
|
||||||
const client = new SapphireClient({
|
const client = new SapphireClient({
|
||||||
defaultPrefix: process.env.DEFAULT_PREFIX,
|
defaultPrefix: process.env.DEFAULT_PREFIX,
|
||||||
@ -49,7 +53,10 @@ const client = new SapphireClient({
|
|||||||
tasks: {
|
tasks: {
|
||||||
bull: {
|
bull: {
|
||||||
connection: {
|
connection: {
|
||||||
host: process.env.REDIS_URL,
|
host: process.env.REDIS_HOST,
|
||||||
|
username: process.env.REDIS_USER,
|
||||||
|
password: process.env.REDIS_PASSWORD,
|
||||||
|
port: REDIS_PORT,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -62,9 +69,12 @@ const main = async () => {
|
|||||||
client.logger.info('Logging in');
|
client.logger.info('Logging in');
|
||||||
|
|
||||||
// Create databases
|
// Create databases
|
||||||
container.database = await new PrismaClient();
|
container.database = new PrismaClient();
|
||||||
container.redis = new Redis({
|
container.redis = new Redis({
|
||||||
host: process.env.REDIS_URL,
|
host: process.env.REDIS_HOST,
|
||||||
|
username: process.env.REDIS_USER,
|
||||||
|
password: process.env.REDIS_PASSWORD,
|
||||||
|
port: REDIS_PORT,
|
||||||
db: 1,
|
db: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user