mirror of
https://github.com/immich-app/immich.git
synced 2025-01-02 12:48:35 +02:00
Add ability to pass redis hostname as env var (#174)
* Add ability to pass redis hostname as env var * Read postgres host from env var in microservices * Update .env.example with postgres and redis hostname vars
This commit is contained in:
parent
87b15c60c0
commit
a44043a4e5
@ -2,6 +2,7 @@
|
|||||||
# Database
|
# Database
|
||||||
###################################################################################
|
###################################################################################
|
||||||
|
|
||||||
|
DB_HOSTNAME=immich_database
|
||||||
DB_USERNAME=postgres
|
DB_USERNAME=postgres
|
||||||
DB_PASSWORD=postgres
|
DB_PASSWORD=postgres
|
||||||
DB_DATABASE_NAME=immich
|
DB_DATABASE_NAME=immich
|
||||||
@ -10,6 +11,16 @@ DB_DATABASE_NAME=immich
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
# Redis
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
REDIS_HOSTNAME=immich_redis
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###################################################################################
|
###################################################################################
|
||||||
# Upload File Config
|
# Upload File Config
|
||||||
###################################################################################
|
###################################################################################
|
||||||
@ -48,4 +59,4 @@ MAPBOX_KEY=
|
|||||||
# For example: If your server IP address is 10.1.11.50, the environment variable will
|
# For example: If your server IP address is 10.1.11.50, the environment variable will
|
||||||
# be VITE_SERVER_ENDPOINT=http://10.1.11.50:2283
|
# be VITE_SERVER_ENDPOINT=http://10.1.11.50:2283
|
||||||
|
|
||||||
VITE_SERVER_ENDPOINT=
|
VITE_SERVER_ENDPOINT=
|
||||||
|
@ -2,7 +2,7 @@ import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
|||||||
|
|
||||||
export const databaseConfig: TypeOrmModuleOptions = {
|
export const databaseConfig: TypeOrmModuleOptions = {
|
||||||
type: 'postgres',
|
type: 'postgres',
|
||||||
host: 'immich_postgres',
|
host: process.env.DB_HOSTNAME || 'immich_postgres',
|
||||||
port: 5432,
|
port: 5432,
|
||||||
username: process.env.DB_USERNAME,
|
username: process.env.DB_USERNAME,
|
||||||
password: process.env.DB_PASSWORD,
|
password: process.env.DB_PASSWORD,
|
||||||
|
@ -39,7 +39,7 @@ import { ScheduleTasksModule } from './modules/schedule-tasks/schedule-tasks.mod
|
|||||||
BullModule.forRootAsync({
|
BullModule.forRootAsync({
|
||||||
useFactory: async () => ({
|
useFactory: async () => ({
|
||||||
redis: {
|
redis: {
|
||||||
host: 'immich_redis',
|
host: process.env.REDIS_HOSTNAME || 'immich_redis',
|
||||||
port: 6379,
|
port: 6379,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
@ -3,12 +3,13 @@ import { RedisClient } from 'redis';
|
|||||||
import { ServerOptions } from 'socket.io';
|
import { ServerOptions } from 'socket.io';
|
||||||
import { createAdapter } from 'socket.io-redis';
|
import { createAdapter } from 'socket.io-redis';
|
||||||
|
|
||||||
// const pubClient = createClient({ url: 'redis://immich_redis:6379' });
|
const redis_host = process.env.REDIS_HOSTNAME || 'immich_redis'
|
||||||
|
// const pubClient = createClient({ url: `redis://${redis_host}:6379` });
|
||||||
// const subClient = pubClient.duplicate();
|
// const subClient = pubClient.duplicate();
|
||||||
|
|
||||||
const pubClient = new RedisClient({
|
const pubClient = new RedisClient({
|
||||||
|
host: redis_host,
|
||||||
port: 6379,
|
port: 6379,
|
||||||
host: 'immich_redis',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const subClient = pubClient.duplicate();
|
const subClient = pubClient.duplicate();
|
||||||
|
Loading…
Reference in New Issue
Block a user