mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
style(exec, nginx, docs): tidy formatting and indentation across Execute.ts, NginxConfigurator.ts, and Telemetry Documentation
This commit is contained in:
@@ -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);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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, "");
|
||||
|
||||
Reference in New Issue
Block a user