Bug on init.

This commit is contained in:
charlesgauthereau
2025-08-07 15:46:41 +02:00
parent baeec9f7a0
commit 8c9d694b40
3 changed files with 12 additions and 16 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
export async function register() { export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") { if (process.env.NEXT_RUNTIME === "nodejs") {
const init = await import("@/utils/init"); const init = await import("@/utils/init");
init.init(); await init.init();
} }
} }
+1 -1
View File
@@ -30,7 +30,7 @@ export const env = createEnv({
S3_PORT: z.string().optional(), S3_PORT: z.string().optional(),
S3_USE_SSL: z.string().optional(), S3_USE_SSL: z.string().optional(),
STORAGE_TYPE: z.string().optional(), STORAGE_TYPE: z.enum(["local", "s3"]).optional(),
}, },
client: { client: {
NEXT_PUBLIC_PROJECT_NAME: z.string().optional(), NEXT_PUBLIC_PROJECT_NAME: z.string().optional(),
+3 -7
View File
@@ -1,6 +1,6 @@
import { env } from "@/env.mjs"; import {env} from "@/env.mjs";
import {db, makeMigration} from "@/db"; import {db, makeMigration} from "@/db";
import { eq } from "drizzle-orm"; import {eq} from "drizzle-orm";
import * as drizzleDb from "@/db"; import * as drizzleDb from "@/db";
@@ -10,17 +10,13 @@ export async function init() {
await makeMigration(); await makeMigration();
await createDefaultOrganization(); await createDefaultOrganization();
await createSettingsIfNotExist() await createSettingsIfNotExist()
.then(() => {
console.log("====Initialization completed===="); console.log("====Initialization completed====");
})
.catch((err) => {
console.error("Error during initialization:", err);
});
} }
async function createSettingsIfNotExist() { async function createSettingsIfNotExist() {
const configSettings = { const configSettings = {
name: "system", name: "system",
storage: env.STORAGE_TYPE!,
smtpPassword: env.SMTP_PASSWORD ?? null, smtpPassword: env.SMTP_PASSWORD ?? null,
smtpFrom: env.SMTP_FROM ?? null, smtpFrom: env.SMTP_FROM ?? null,
smtpHost: env.SMTP_HOST ?? null, smtpHost: env.SMTP_HOST ?? null,