style(exec, nginx, docs): tidy formatting and indentation across Execute.ts, NginxConfigurator.ts, and Telemetry Documentation

This commit is contained in:
Nawaz Dhandala
2025-11-06 19:41:57 +00:00
parent bf6e97c35d
commit e31417c5bf
3 changed files with 36 additions and 36 deletions

View File

@@ -93,35 +93,37 @@ export default class Execute {
args?: Array<string>;
options?: SpawnOptions;
}): Promise<void> {
return new Promise((resolve: VoidFunction, reject: PromiseRejectErrorFunction) => {
const spawnOptions: SpawnOptions = {
stdio: ["ignore", "inherit", "inherit"],
shell: false,
...data.options,
};
return new Promise(
(resolve: VoidFunction, reject: PromiseRejectErrorFunction) => {
const spawnOptions: SpawnOptions = {
stdio: ["ignore", "inherit", "inherit"],
shell: false,
...data.options,
};
const child = spawn(data.command, data.args ?? [], spawnOptions);
const child = spawn(data.command, data.args ?? [], spawnOptions);
child.on("error", (err: Error) => {
logger.error(
`Error executing command: ${data.command} ${(data.args ?? []).join(" ")}`,
);
logger.error(err);
reject(err);
});
child.on("error", (err: Error) => {
logger.error(
`Error executing command: ${data.command} ${(data.args ?? []).join(" ")}`,
);
logger.error(err);
reject(err);
});
child.on("close", (code: number | null) => {
if (code === 0) {
resolve();
return;
}
child.on("close", (code: number | null) => {
if (code === 0) {
resolve();
return;
}
const error: Error = new Error(
`Command failed: ${data.command} ${(data.args ?? []).join(" ")} (exit code ${code ?? "unknown"})`,
);
logger.error(error);
reject(error);
});
});
const error: Error = new Error(
`Command failed: ${data.command} ${(data.args ?? []).join(" ")} (exit code ${code ?? "unknown"})`,
);
logger.error(error);
reject(error);
});
},
);
}
}

View File

@@ -36,8 +36,6 @@ const TelemetryDocumentation: FunctionComponent = (): ReactElement => {
"Learn how to integrate OneUptime with your application or resources to collect logs, metrics and traces data."
}
>
<ImageTiles
title="Integrate with OpenTelemetry"
description="OneUptime supports a native integration with OpenTelemetry. OpenTelemetry is a collection of tools, APIs, and SDKs used to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) for analysis in order to understand your software performance and behavior."

View File

@@ -13,24 +13,24 @@ export default class NginxConfigurator {
private static readonly ENVSUBST_SCRIPT_PATH: string =
"/etc/nginx/envsubst-on-templates.sh";
private static readonly NGINX_LOG_DIRECTORY: string = "/var/log/nginx";
private static readonly NGINX_ACCESS_LOG_PATH: string =
`${NginxConfigurator.NGINX_LOG_DIRECTORY}/access.log`;
private static readonly NGINX_ERROR_LOG_PATH: string =
`${NginxConfigurator.NGINX_LOG_DIRECTORY}/error.log`;
private static readonly NGINX_ACCESS_LOG_PATH: string = `${NginxConfigurator.NGINX_LOG_DIRECTORY}/access.log`;
private static readonly NGINX_ERROR_LOG_PATH: string = `${NginxConfigurator.NGINX_LOG_DIRECTORY}/error.log`;
private static async ensureLogFiles(): Promise<void> {
try {
await LocalFile.makeDirectory(this.NGINX_LOG_DIRECTORY);
const accessLogExists: boolean =
await LocalFile.doesFileExist(this.NGINX_ACCESS_LOG_PATH);
const accessLogExists: boolean = await LocalFile.doesFileExist(
this.NGINX_ACCESS_LOG_PATH,
);
if (!accessLogExists) {
await LocalFile.write(this.NGINX_ACCESS_LOG_PATH, "");
}
const errorLogExists: boolean =
await LocalFile.doesFileExist(this.NGINX_ERROR_LOG_PATH);
const errorLogExists: boolean = await LocalFile.doesFileExist(
this.NGINX_ERROR_LOG_PATH,
);
if (!errorLogExists) {
await LocalFile.write(this.NGINX_ERROR_LOG_PATH, "");