diff --git a/.env b/.env index 5bb8e9f4..6770a168 100644 --- a/.env +++ b/.env @@ -10,12 +10,17 @@ UMASK_SET=0002 PUID=510 PGID=20 +POSTGRES_HOST=postgres POSTGRES_DB=bobarr POSTGRES_USER=bobarr POSTGRES_PASSWORD=bobarr +REDIS_HOST=redis REDIS_PASSWORD=bobarr +TRANSMISSION_HOST=transmission + +JACKETT_HOST=jackett JACKETT_AUTOMATIC_SEARCH_TIMEOUT=120000 JACKETT_MANUAL_SEARCH_TIMEOUT=15000 diff --git a/packages/api/src/config.ts b/packages/api/src/config.ts index fd3e224a..65c6fd19 100644 --- a/packages/api/src/config.ts +++ b/packages/api/src/config.ts @@ -1,6 +1,6 @@ export const DB_CONFIG = { type: 'postgres' as const, - host: 'postgres', + host: process.env.POSTGRES_HOST || 'postgres' , port: 5432, username: process.env.POSTGRES_USER, password: process.env.POSTGRES_PASSWORD, @@ -11,15 +11,23 @@ export const DB_CONFIG = { export const DEBUG_REDIS = process.env.DEBUG_REDIS === 'true' || false; export const REDIS_CONFIG = { - host: 'redis', + host: process.env.REDIS_HOST, port: 6379, password: process.env.REDIS_PASSWORD, }; -export const JACKETT_RESPONSE_TIMEOUT = { - automatic: Number(process.env.JACKETT_AUTOMATIC_SEARCH_TIMEOUT), - manual: Number(process.env.JACKETT_MANUAL_SEARCH_TIMEOUT), -}; +export const JACKETT_CONFIG = { + timeoutAutomatic: Number(process.env.JACKETT_AUTOMATIC_SEARCH_TIMEOUT), + timeoutManual: Number(process.env.JACKETT_MANUAL_SEARCH_TIMEOUT), + host: process.env.JACKETT_HOST || 'jackett', + port: process.env.JACKETT_PORT || '9117', + +} + +export const TRANSMISSION_CONFIG = { + host: process.env.TRANSMISSION_HOST || 'transmission', + port: process.env.TRANSMISSION_PORT || '9091' +} export const LIBRARY_CONFIG = { moviesFolderName: process.env.LIBRARY_MOVIES_FOLDER_NAME, diff --git a/packages/api/src/modules/jackett/jackett.service.ts b/packages/api/src/modules/jackett/jackett.service.ts index 0252dc1b..827fa7d7 100644 --- a/packages/api/src/modules/jackett/jackett.service.ts +++ b/packages/api/src/modules/jackett/jackett.service.ts @@ -22,7 +22,7 @@ import { Tag } from 'src/entities/tag.entity'; import { JackettResult, JackettIndexer } from './jackett.dto'; import { Entertainment } from '../tmdb/tmdb.dto'; import { PromiseRaceAll } from 'src/utils/promise-resolve'; -import { JACKETT_RESPONSE_TIMEOUT } from 'src/config'; +import { JACKETT_CONFIG } from 'src/config'; @Injectable() export class JackettService { @@ -42,7 +42,7 @@ export class JackettService { ); const client = axios.create({ - baseURL: 'http://jackett:9117/api/v2.0/indexers/all', + baseURL: `http://{JACKETT_CONFIG.host}:{JACKETT_CONFIG.port}/api/v2.0/indexers/all`, params: { apikey: jackettApiKey }, }); @@ -176,8 +176,8 @@ export class JackettService { const resolvedIndexers = await PromiseRaceAll( allIndexers, opts.withoutFilter - ? JACKETT_RESPONSE_TIMEOUT.manual - : JACKETT_RESPONSE_TIMEOUT.automatic + ? JACKETT_CONFIG.timeoutManual + : JACKETT_CONFIG.timeoutAutomatic ); const flattenIndexers = resolvedIndexers .filter((item) => Boolean(item)) diff --git a/packages/api/src/modules/transmission/transmission.service.ts b/packages/api/src/modules/transmission/transmission.service.ts index 47a1fb0e..87538b27 100644 --- a/packages/api/src/modules/transmission/transmission.service.ts +++ b/packages/api/src/modules/transmission/transmission.service.ts @@ -10,9 +10,11 @@ import { Torrent } from 'src/entities/torrent.entity'; import { TorrentDAO } from 'src/entities/dao/torrent.dao'; import { LazyTransaction } from 'src/utils/lazy-transaction'; +import { TRANSMISSION_CONFIG } from 'src/config'; + @Injectable() export class TransmissionService { - private client = new Transmission({ host: 'transmission' }); + private client = new Transmission({ host: TRANSMISSION_CONFIG.host, port: TRANSMISSION_CONFIG.port }); public constructor( @Inject(WINSTON_MODULE_PROVIDER) private logger: Logger,