mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor(admin-dashboard, nginx): normalize multiline formatting in Serve.ts, NginxConfigurator.ts and WriteServerCertToDisk.ts
This commit is contained in:
@@ -35,7 +35,9 @@ const ensureMasterAdminAccess: EnsureMasterAdminAccessFunction = async (
|
||||
Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotAuthorizedException("Unauthorized: Only master admins can access the admin dashboard."),
|
||||
new NotAuthorizedException(
|
||||
"Unauthorized: Only master admins can access the admin dashboard.",
|
||||
),
|
||||
);
|
||||
return {};
|
||||
}
|
||||
@@ -46,7 +48,9 @@ const ensureMasterAdminAccess: EnsureMasterAdminAccessFunction = async (
|
||||
Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotAuthorizedException("Unauthorized: Only master admins can access the admin dashboard."),
|
||||
new NotAuthorizedException(
|
||||
"Unauthorized: Only master admins can access the admin dashboard.",
|
||||
),
|
||||
);
|
||||
return {};
|
||||
}
|
||||
@@ -57,7 +61,9 @@ const ensureMasterAdminAccess: EnsureMasterAdminAccessFunction = async (
|
||||
Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotAuthorizedException("Unauthorized: Only master admins can access the admin dashboard."),
|
||||
new NotAuthorizedException(
|
||||
"Unauthorized: Only master admins can access the admin dashboard.",
|
||||
),
|
||||
);
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -77,10 +77,11 @@ export default class WriteServerCertToDiskJob {
|
||||
(await LocalFile.doesFileExist(certificatePath))
|
||||
? await LocalFile.read(certificatePath)
|
||||
: null;
|
||||
const existingKey: string | null =
|
||||
(await LocalFile.doesFileExist(keyPath))
|
||||
? await LocalFile.read(keyPath)
|
||||
: null;
|
||||
const existingKey: string | null = (await LocalFile.doesFileExist(
|
||||
keyPath,
|
||||
))
|
||||
? await LocalFile.read(keyPath)
|
||||
: null;
|
||||
|
||||
const certificateChanged: boolean =
|
||||
existingCertificate !== certificatePem ||
|
||||
|
||||
@@ -25,8 +25,7 @@ export default class NginxConfigurator {
|
||||
return;
|
||||
}
|
||||
|
||||
const certificateDirective: string =
|
||||
`ssl_certificate /etc/nginx/certs/ServerCerts/${normalizedHost}.crt;`;
|
||||
const certificateDirective: string = `ssl_certificate /etc/nginx/certs/ServerCerts/${normalizedHost}.crt;`;
|
||||
|
||||
let nginxConfig: string = "";
|
||||
try {
|
||||
@@ -38,11 +37,11 @@ export default class NginxConfigurator {
|
||||
logger.debug(err);
|
||||
}
|
||||
|
||||
const templateHasDirective: boolean = nginxConfig.includes(
|
||||
certificateDirective,
|
||||
);
|
||||
const templateHasDirective: boolean =
|
||||
nginxConfig.includes(certificateDirective);
|
||||
const shouldRefreshTemplate: boolean = !templateHasDirective;
|
||||
const shouldReload: boolean = options.forceReload === true || shouldRefreshTemplate;
|
||||
const shouldReload: boolean =
|
||||
options.forceReload === true || shouldRefreshTemplate;
|
||||
|
||||
if (!shouldReload) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user