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.
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 └────────────────────────────────

View file

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

View file

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

View file

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

View file

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