mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-22 15:12:28 -04:00
Manually fix migrations and startup
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ export const db = drizzle({
|
||||
database: process.env.POSTGRES_DB ?? "kyooDB",
|
||||
host: process.env.POSTGRES_SERVER ?? "postgres",
|
||||
port: Number(process.env.POSTGRES_PORT) || 5432,
|
||||
ssl: true,
|
||||
ssl: false,
|
||||
},
|
||||
casing: "snake_case",
|
||||
});
|
||||
|
||||
@@ -70,7 +70,7 @@ export const shows = schema.table(
|
||||
(t) => ({
|
||||
ratingValid: check(
|
||||
"ratingValid",
|
||||
sql`0 <= ${t.rating} && ${t.rating} <= 100`,
|
||||
sql`${t.rating} between 0 and 100`,
|
||||
),
|
||||
runtimeValid: check("runtimeValid", sql`0 <= ${t.runtime}`),
|
||||
}),
|
||||
|
||||
+12
-5
@@ -5,18 +5,25 @@ import { migrate } from "drizzle-orm/node-postgres/migrator";
|
||||
import { movies } from "./controllers/movies";
|
||||
import jwt from "@elysiajs/jwt";
|
||||
|
||||
await migrate(db, { migrationsFolder: "" });
|
||||
await migrate(db, { migrationsSchema: "kyoo", migrationsFolder: "./drizzle" });
|
||||
|
||||
if (process.env.SEED) {
|
||||
}
|
||||
|
||||
let secret = process.env.JWT_SECRET;
|
||||
if (!secret) {
|
||||
const auth = process.env.AUTH_SERVER ?? "http://auth:4568";
|
||||
const ret = await fetch(`${auth}/info`);
|
||||
const info = await ret.json();
|
||||
secret = info.publicKey;
|
||||
try {
|
||||
const ret = await fetch(`${auth}/info`);
|
||||
const info = await ret.json();
|
||||
secret = info.publicKey;
|
||||
} catch (error) {
|
||||
console.error(`Can't access auth server at ${auth}:\n${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!secret) {
|
||||
console.error("missing jwt secret or auth server. exiting");
|
||||
console.error("Missing jwt secret or auth server. exiting");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user