Https Setup

This commit is contained in:
Josef 2025-11-11 11:33:59 +01:00
parent fe9562b596
commit 9ca647b326
2 changed files with 20 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import Fastify, { FastifyInstance, FastifyListenOptions } from "fastify"; import Fastify, { FastifyHttpsOptions, FastifyInstance, FastifyListenOptions } from "fastify";
import fastifyMultipart from "@fastify/multipart"; import fastifyMultipart from "@fastify/multipart";
import cors from '@fastify/cors'; import cors from '@fastify/cors';
@ -89,8 +89,23 @@ export class UserManagementServer
async _initializeApp():Promise<void> async _initializeApp():Promise<void>
{ {
if ( this._settings.isDebugMode )
{
this._app = Fastify(); this._app = Fastify();
}
else
{
this._app = Fastify(
{
https:
{
key:this._settings.httpsKeyPath,
cert:this._settings.httpsCertPath
}
}
);
}
this._app.register( fastifyMultipart ); this._app.register( fastifyMultipart );
for ( let corsURL of this._settings.corsURLs ) for ( let corsURL of this._settings.corsURLs )

View File

@ -8,6 +8,8 @@ export class UserManagementServerSettings
port:number = 8084; port:number = 8084;
corsURLs:string[] = []; corsURLs:string[] = [];
isDebugMode:boolean = false; isDebugMode:boolean = false;
httpsKeyPath:string;
httpsCertPath:string;
// Paths // Paths
rootPath:string; rootPath:string;