mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 16:55:37 +02:00
## Description This fixes the issue where Cloudflare fails ## Related Issues <!-- List any related issues (e.g., "Closes #123", "Fixes #456") --> ## Type of Change - [x] Bug fix (non-breaking change) - [ ] New feature (non-breaking change) - [ ] Breaking change (fix or feature that changes existing functionality) - [ ] Documentation update - [ ] Other (please describe): ## Checklist - [x] I have updated relevant documentation - [x] My code follows the project's coding style - [x] My changes generate no new warnings/errors
39 lines
944 B
TypeScript
39 lines
944 B
TypeScript
|
|
const dbProject = new neon.Project("Nestri", {
|
|
historyRetentionSeconds: 86400,
|
|
name:"Nestri"
|
|
})
|
|
|
|
const dbBranchId = $app.stage !== "production" ?
|
|
new neon.Branch("DatabaseBranch", {
|
|
parentId: dbProject.defaultBranchId,
|
|
projectId: dbProject.id,
|
|
name: $app.stage,
|
|
}).id : dbProject.defaultBranchId
|
|
|
|
const dbEndpoint = new neon.Endpoint("NestriEndpoint", {
|
|
projectId: dbProject.id,
|
|
branchId: dbBranchId
|
|
})
|
|
|
|
const dbRole = new neon.Role("AdminRole", {
|
|
name: "admin",
|
|
branchId: dbBranchId,
|
|
projectId: dbProject.id,
|
|
})
|
|
|
|
const db = new neon.Database("NestriDatabase", {
|
|
branchId: dbBranchId,
|
|
projectId: dbProject.id,
|
|
ownerName: dbRole.name,
|
|
name: `nestri-${$app.stage}`,
|
|
})
|
|
|
|
export const database = new sst.Linkable("Database", {
|
|
properties: {
|
|
name: db.name,
|
|
user: dbRole.name,
|
|
host: dbEndpoint.host,
|
|
password: dbRole.password,
|
|
},
|
|
}); |