From 553efb1da68fa4af5b305e4212cd1d8ae3a6d179 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 21 Sep 2023 16:26:32 +0400 Subject: [PATCH] New config entries --- .env.example | 2 ++ src/app.ts | 5 ++++- src/config/config.service.ts | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 22b7787..26f6507 100644 --- a/.env.example +++ b/.env.example @@ -2,3 +2,5 @@ HOST=127.0.0.1 # 0.0.0.0 if txtdot is not behind reverse proxy PORT=8080 REVERSE_PROXY=true # only for reverse proxy; see docs + +PROXY_RES=true diff --git a/src/app.ts b/src/app.ts index 8c1f59f..6843d3c 100644 --- a/src/app.ts +++ b/src/app.ts @@ -55,7 +55,10 @@ class App { fastify.register(indexRoute); fastify.register(getRoute); - fastify.register(proxyRoute); + + if (this.config.proxy_res) + fastify.register(proxyRoute); + fastify.register(parseRoute); fastify.register(rawHtml); diff --git a/src/config/config.service.ts b/src/config/config.service.ts index fa870ab..13ddb8d 100644 --- a/src/config/config.service.ts +++ b/src/config/config.service.ts @@ -4,6 +4,7 @@ export class ConfigService { public readonly host: string; public readonly port: number; public readonly reverse_proxy: boolean; + public readonly proxy_res: boolean; constructor() { config(); @@ -12,5 +13,7 @@ export class ConfigService { this.port = Number(process.env.PORT) || 8080; this.reverse_proxy = Boolean(process.env.REVERSE_PROXY) || false; + + this.proxy_res = Boolean(process.env.PROXY_RES) || true; } }