You can access the database name from `sanitizedConfig.db.name`. But currently, it' not possible to access the db name from the unsanitized config. Plugins only have access to the unsanitized config. This change allows db adapters to return the db name early, which will allow plugins to conditionally initialize db-specific functionality
Payload Postgres Adapter
Vercel Postgres adapter for Payload.
Installation
npm install @payloadcms/db-vercel-postgres
Usage
Explicit Connection String
import { buildConfig } from 'payload'
import { vercelPostgresAdapter } from '@payloadcms/db-vercel-postgres'
export default buildConfig({
db: vercelPostgresAdapter({
pool: {
connectionString: process.env.DATABASE_URI,
},
}),
// ...rest of config
})
Automatic Connection String Detection
Have Vercel automatically detect from environment variable (typically process.env.POSTGRES_URL)
export default buildConfig({
db: postgresAdapter(),
// ...rest of config
})
More detailed usage can be found in the Payload Docs.