Skip to content

Commit 935704e

Browse files
committed
feat(website): write the config to a json file
1 parent 65cf1c8 commit 935704e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

apps/website/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ COPY --from=website-builder --chown=ryot:ryot /app/apps/website/node_modules ./n
3030
COPY --from=website-builder --chown=ryot:ryot /app/apps/website/package.json ./package.json
3131
COPY --from=website-builder --chown=ryot:ryot /app/apps/website/build ./build
3232
COPY --chown=ryot:ryot apps/website/app/drizzle/migrations app/drizzle/migrations
33-
CMD npx react-router-serve ./build/server/index.js
33+
CMD mkdir tmp && npx react-router-serve ./build/server/index.js

apps/website/app/entry.server.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ import {
88
type EntryContext,
99
ServerRouter,
1010
} from "react-router";
11-
import { db } from "./lib/config.server";
11+
import { db, serverVariables, TEMP_DIRECTORY } from "./lib/config.server";
12+
import { writeFileSync } from "node:fs";
1213

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

19+
writeFileSync(
20+
`${TEMP_DIRECTORY}/website-config.json`,
21+
JSON.stringify(serverVariables, null, 2),
22+
);
23+
1824
const ABORT_DELAY = 5_000;
1925

2026
export default function handleRequest(

apps/website/app/lib/config.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import { PlanTypes, ProductTypes } from "~/drizzle/schema.server";
1717
// The number of days after a subscription expires that we allow access
1818
export const GRACE_PERIOD = 7;
1919

20+
export const TEMP_DIRECTORY =
21+
process.env.NODE_ENV === "development" ? "/tmp" : "tmp";
22+
2023
export const serverVariablesSchema = z.object({
2124
FRONTEND_URL: z.string(),
2225
UNKEY_API_ID: z.string(),

0 commit comments

Comments
 (0)