summaryrefslogtreecommitdiff
path: root/packages/backend/src/config.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2025-02-10 10:40:06 +0000
committerdakkar <dakkar@thenautilus.net>2025-02-10 10:40:06 +0000
commit427d09e643a554a6711b9349f8a6bbc3499dcfb7 (patch)
treeff598de275fd7de3877e56a3419c436646b9f8b1 /packages/backend/src/config.ts
parentmerge: Rework rate limit factors and add caching (resolves #884) (!884) (diff)
downloadsharkey-427d09e643a554a6711b9349f8a6bbc3499dcfb7.tar.gz
sharkey-427d09e643a554a6711b9349f8a6bbc3499dcfb7.tar.bz2
sharkey-427d09e643a554a6711b9349f8a6bbc3499dcfb7.zip
make the listen address configurable - fixes #927
sadly `fastify.listen` doesn't support passing more than 1 address
Diffstat (limited to 'packages/backend/src/config.ts')
-rw-r--r--packages/backend/src/config.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts
index 4af1140f36..1a3a916624 100644
--- a/packages/backend/src/config.ts
+++ b/packages/backend/src/config.ts
@@ -27,6 +27,7 @@ type RedisOptionsSource = Partial<RedisOptions> & {
type Source = {
url?: string;
port?: number;
+ address?: string;
socket?: string;
chmodSocket?: string;
disableHsts?: boolean;
@@ -123,6 +124,7 @@ type Source = {
export type Config = {
url: string;
port: number;
+ address: string;
socket: string | undefined;
chmodSocket: string | undefined;
disableHsts: boolean | undefined;
@@ -288,6 +290,7 @@ export function loadConfig(): Config {
setupPassword: config.setupPassword,
url: url.origin,
port: config.port ?? parseInt(process.env.PORT ?? '3000', 10),
+ address: config.address ?? '0.0.0.0',
socket: config.socket,
chmodSocket: config.chmodSocket,
disableHsts: config.disableHsts,
@@ -488,7 +491,7 @@ function applyEnvOverrides(config: Source) {
// these are all the settings that can be overridden
- _apply_top([['url', 'port', 'socket', 'chmodSocket', 'disableHsts', 'id', 'dbReplications']]);
+ _apply_top([['url', 'port', 'address', 'socket', 'chmodSocket', 'disableHsts', 'id', 'dbReplications']]);
_apply_top(['db', ['host', 'port', 'db', 'user', 'pass', 'disableCache']]);
_apply_top(['dbSlaves', Array.from((config.dbSlaves ?? []).keys()), ['host', 'port', 'db', 'user', 'pass']]);
_apply_top([