Set host in Fastify
This commit is contained in:
parent
d98d59705a
commit
fe9562b596
|
|
@ -1,4 +1,4 @@
|
||||||
import Fastify, { FastifyInstance } from "fastify";
|
import Fastify, { FastifyInstance, FastifyListenOptions } from "fastify";
|
||||||
import fastifyMultipart from "@fastify/multipart";
|
import fastifyMultipart from "@fastify/multipart";
|
||||||
import cors from '@fastify/cors';
|
import cors from '@fastify/cors';
|
||||||
|
|
||||||
|
|
@ -150,9 +150,19 @@ export class UserManagementServer
|
||||||
|
|
||||||
async _startServer()
|
async _startServer()
|
||||||
{
|
{
|
||||||
|
let listenOptions:FastifyListenOptions =
|
||||||
|
{
|
||||||
|
port: this._settings.port
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! this._settings.isDebugMode )
|
||||||
|
{
|
||||||
|
listenOptions.host = "0.0.0.0";
|
||||||
|
}
|
||||||
|
|
||||||
this.app.listen(
|
this.app.listen(
|
||||||
|
|
||||||
{ port: this._settings.port },
|
listenOptions,
|
||||||
|
|
||||||
( error, address ) =>
|
( error, address ) =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ export class UserManagementServerSettings
|
||||||
url:string;
|
url:string;
|
||||||
port:number = 8084;
|
port:number = 8084;
|
||||||
corsURLs:string[] = [];
|
corsURLs:string[] = [];
|
||||||
|
isDebugMode:boolean = false;
|
||||||
|
|
||||||
// Paths
|
// Paths
|
||||||
rootPath:string;
|
rootPath:string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue