More use of isProduction/isDevelopment getters

This commit is contained in:
Tom Moor
2023-11-09 09:32:46 -05:00
parent 1ace76eb44
commit 0964d03a17
16 changed files with 22 additions and 28 deletions

View File

@@ -20,8 +20,6 @@ import {
} from "@server/errors";
import { requestErrorHandler } from "@server/logging/sentry";
const isDev = env.ENVIRONMENT === "development";
const isProd = env.ENVIRONMENT === "production";
let errorHtmlCache: Buffer | undefined;
export default function onerror(app: Koa) {
@@ -159,11 +157,11 @@ function wrapInNativeError(err: any): Error {
}
function readErrorFile(): Buffer {
if (isDev) {
if (env.isDevelopment) {
return fs.readFileSync(path.join(__dirname, "error.dev.html"));
}
if (isProd) {
if (env.isProduction) {
return (
errorHtmlCache ??
(errorHtmlCache = fs.readFileSync(