Skip to content

Commit

Permalink
Merge branch 'main' into issue-1235
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Feb 11, 2025
2 parents bd8c52d + 935704e commit 50005a9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/website/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ COPY --from=website-builder --chown=ryot:ryot /app/apps/website/node_modules ./n
COPY --from=website-builder --chown=ryot:ryot /app/apps/website/package.json ./package.json
COPY --from=website-builder --chown=ryot:ryot /app/apps/website/build ./build
COPY --chown=ryot:ryot apps/website/app/drizzle/migrations app/drizzle/migrations
CMD npx react-router-serve ./build/server/index.js
CMD mkdir tmp && npx react-router-serve ./build/server/index.js
8 changes: 7 additions & 1 deletion apps/website/app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ import {
type EntryContext,
ServerRouter,
} from "react-router";
import { db } from "./lib/config.server";
import { db, serverVariables, TEMP_DIRECTORY } from "./lib/config.server";
import { writeFileSync } from "node:fs";

migrate(db, { migrationsFolder: "app/drizzle/migrations" }).catch((error) => {
console.error("Database migrations failed", error);
process.exit(1);
});

writeFileSync(
`${TEMP_DIRECTORY}/website-config.json`,
JSON.stringify(serverVariables, null, 2),
);

const ABORT_DELAY = 5_000;

export default function handleRequest(
Expand Down
3 changes: 3 additions & 0 deletions apps/website/app/lib/config.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import { PlanTypes, ProductTypes } from "~/drizzle/schema.server";
// The number of days after a subscription expires that we allow access
export const GRACE_PERIOD = 7;

export const TEMP_DIRECTORY =
process.env.NODE_ENV === "development" ? "/tmp" : "tmp";

export const serverVariablesSchema = z.object({
FRONTEND_URL: z.string(),
UNKEY_API_ID: z.string(),
Expand Down

0 comments on commit 50005a9

Please sign in to comment.