chore: Centralize environment detection

This commit is contained in:
Tom Moor
2023-11-09 09:13:50 -05:00
parent 096a65b0f9
commit a1b52e18dd
9 changed files with 37 additions and 31 deletions

View File

@@ -3,8 +3,6 @@ import ReactDOMServer from "react-dom/server";
import env from "@server/env";
import readManifestFile, { ManifestStructure } from "./readManifestFile";
const isProduction = env.ENVIRONMENT === "production";
const prefetchTags = [];
if (env.AWS_S3_ACCELERATE_URL) {
@@ -30,7 +28,7 @@ if (env.CDN_URL) {
);
}
if (isProduction) {
if (env.isProduction) {
const manifest = readManifestFile();
const returnFileAndImportsFromManifest = (

View File

@@ -33,11 +33,10 @@ export async function checkDataMigrations() {
return;
}
const isProduction = env.ENVIRONMENT === "production";
const teams = await Team.count();
const providers = await AuthenticationProvider.count();
if (isProduction && teams && !providers) {
if (env.isProduction && teams && !providers) {
Logger.warn(`
This version of Outline cannot start until a data migration is complete.
Backup your database, run the database migrations and the following script: