Merge branch 'gh-fa55fa5e/10502/unknown/add-bind-addr-config' into 'develop'

[PR]: Add bind address option

See merge request firefish/firefish!10502
This commit is contained in:
Kainoa Kanter 2023-07-28 18:32:34 +00:00
commit 6d1f93a022
5 changed files with 19 additions and 4 deletions

View File

@ -29,6 +29,10 @@ url: https://example.com/
# The port that your Firefish server should listen on. # The port that your Firefish server should listen on.
port: 3000 port: 3000
# The bind host your Calckey server should listen on.
# If unspecified, the wildcard address will be used.
#bind: 127.0.0.1
# ┌──────────────────────────┐ # ┌──────────────────────────┐
#───┘ PostgreSQL configuration └──────────────────────────────── #───┘ PostgreSQL configuration └────────────────────────────────

View File

@ -106,7 +106,11 @@ export async function masterMain() {
config = loadConfigBoot(); config = loadConfigBoot();
await connectDb(); await connectDb();
} catch (e) { } catch (e) {
bootLogger.error("Fatal error occurred during initialization", null, true); bootLogger.error(
`Fatal error occurred during initialization: ${e}`,
null,
true,
);
process.exit(1); process.exit(1);
} }

View File

@ -41,6 +41,7 @@ export default function load() {
config.url = url.origin; config.url = url.origin;
config.port = config.port || parseInt(process.env.PORT || "", 10); config.port = config.port || parseInt(process.env.PORT || "", 10);
config.bind = config.bind || process.env.BIND;
mixin.version = meta.version; mixin.version = meta.version;
mixin.host = url.host; mixin.host = url.host;

View File

@ -6,6 +6,7 @@ export type Source = {
feedback_url?: string; feedback_url?: string;
url: string; url: string;
port: number; port: number;
bind?: string;
disableHsts?: boolean; disableHsts?: boolean;
db: { db: {
host: string; host: string;

View File

@ -221,7 +221,10 @@ export const startServer = () => {
initializeStreamingServer(server); initializeStreamingServer(server);
server.listen(config.port); server.listen({
port: config.port,
host: config.bind
});
return server; return server;
}; };
@ -257,6 +260,8 @@ export default () =>
} }
}); });
// @ts-ignore server.listen({
server.listen(config.port, resolve); port: config.port,
host: config.bind
}, () => resolve(undefined));
}); });