Skip to content

Commit

Permalink
Missing piece
Browse files Browse the repository at this point in the history
  • Loading branch information
balegas committed Nov 14, 2024
1 parent 6d12488 commit b06f8b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions examples/nextjs-example/app/db.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pgPkg from "pg"
const { Client } = pgPkg

console.log(process.env.DATABASE_URL)

const db = new Client({
connectionString: process.env.DATABASE_URL,
})
Expand Down
6 changes: 4 additions & 2 deletions examples/nextjs-example/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default $config({
addDatabaseToElectric(uri)
)

const website = deployNextJsExample(electricInfo)
const website = deployNextJsExample(electricInfo, databaseUri)
return {
databaseUri,
database_id: electricInfo.id,
Expand All @@ -61,13 +61,15 @@ function applyMigrations(uri: string) {
}

function deployNextJsExample(
electricInfo: $util.Output<{ id: string; token: string }>
electricInfo: $util.Output<{ id: string; token: string }>,
uri: $util.Output<string>
) {
return new sst.aws.Nextjs(`nextjs`, {
environment: {
ELECTRIC_URL: process.env.ELECTRIC_API!,
ELECTRIC_TOKEN: electricInfo.token,
DATABASE_ID: electricInfo.id,
DATABASE_URL: uri,
},
domain: {
name: `nextjs${$app.stage === `production` ? `` : `-stage-${$app.stage}`}.electric-sql.com`,
Expand Down

0 comments on commit b06f8b1

Please sign in to comment.