make the listen address configurable - fixes #927

sadly `fastify.listen` doesn't support passing more than 1 address
This commit is contained in:
dakkar 2025-02-10 10:40:06 +00:00
parent 50a3e55be4
commit 427d09e643
4 changed files with 10 additions and 3 deletions

View file

@ -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([