TODOs: - [x] Do restart when checkout / restore if there is a DB - [x] List all branches (branch id, name, date) - [x] Allow checking out versions with no DB - [x] safeguard to never delete main branches - [x] create app hook for neon template - [x] weird UX with connector on configure panel - [x] tiny neon logo in connector - [x] deploy to vercel - [x] build forgot password page - [x] what about email setup - [x] lots of imgix errors - [x] edit file - db snapshot - [x] DYAD_DISABLE_DB_PUSH - [ ] update portal doc - [x] switch preview branch to be read-only endpoint - [x] disable supabase sys prompt if neon is enabled - [ ] https://payloadcms.com/docs/upload/storage-adapters - [x] need to use main branch... Phase 2? - [x] generate DB migrations
46 lines
997 B
TypeScript
46 lines
997 B
TypeScript
import { IpcClient } from "@/ipc/ipc_client";
|
|
|
|
import { v4 as uuidv4 } from "uuid";
|
|
|
|
export async function neonTemplateHook({
|
|
appId,
|
|
appName,
|
|
}: {
|
|
appId: number;
|
|
appName: string;
|
|
}) {
|
|
console.log("Creating Neon project");
|
|
const neonProject = await IpcClient.getInstance().createNeonProject({
|
|
name: appName,
|
|
appId: appId,
|
|
});
|
|
|
|
console.log("Neon project created", neonProject);
|
|
await IpcClient.getInstance().setAppEnvVars({
|
|
appId: appId,
|
|
envVars: [
|
|
{
|
|
key: "POSTGRES_URL",
|
|
value: neonProject.connectionString,
|
|
},
|
|
{
|
|
key: "PAYLOAD_SECRET",
|
|
value: uuidv4(),
|
|
},
|
|
{
|
|
key: "NEXT_PUBLIC_SERVER_URL",
|
|
value: "http://localhost:32100",
|
|
},
|
|
{
|
|
key: "GMAIL_USER",
|
|
value: "example@gmail.com",
|
|
},
|
|
{
|
|
key: "GOOGLE_APP_PASSWORD",
|
|
value: "GENERATE AT https://myaccount.google.com/apppasswords",
|
|
},
|
|
],
|
|
});
|
|
console.log("App env vars set");
|
|
}
|