New config entries

This commit is contained in:
DarkCat09 2023-09-21 16:26:32 +04:00
parent 47e4db1fc8
commit 553efb1da6
No known key found for this signature in database
GPG Key ID: 0A26CD5B3345D6E3
3 changed files with 9 additions and 1 deletions

View File

@ -2,3 +2,5 @@ HOST=127.0.0.1 # 0.0.0.0 if txtdot is not behind reverse proxy
PORT=8080 PORT=8080
REVERSE_PROXY=true # only for reverse proxy; see docs REVERSE_PROXY=true # only for reverse proxy; see docs
PROXY_RES=true

View File

@ -55,7 +55,10 @@ class App {
fastify.register(indexRoute); fastify.register(indexRoute);
fastify.register(getRoute); fastify.register(getRoute);
fastify.register(proxyRoute);
if (this.config.proxy_res)
fastify.register(proxyRoute);
fastify.register(parseRoute); fastify.register(parseRoute);
fastify.register(rawHtml); fastify.register(rawHtml);

View File

@ -4,6 +4,7 @@ export class ConfigService {
public readonly host: string; public readonly host: string;
public readonly port: number; public readonly port: number;
public readonly reverse_proxy: boolean; public readonly reverse_proxy: boolean;
public readonly proxy_res: boolean;
constructor() { constructor() {
config(); config();
@ -12,5 +13,7 @@ export class ConfigService {
this.port = Number(process.env.PORT) || 8080; this.port = Number(process.env.PORT) || 8080;
this.reverse_proxy = Boolean(process.env.REVERSE_PROXY) || false; this.reverse_proxy = Boolean(process.env.REVERSE_PROXY) || false;
this.proxy_res = Boolean(process.env.PROXY_RES) || true;
} }
} }