Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make hostnames for support services configurable via env #255

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 14 additions & 6 deletions packages/api/src/config.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/modules/jackett/jackett.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 },
});

Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down