Skip to content

Conversation

@FinnIckler
Copy link
Member

I assume this won't deploy though because just importing import { sqliteAdapter } from "@payloadcms/db-sqlite"; will lead the server to crash because of needed libs if I remember correctly. We fixed that with some dynamic imports last time, but that would mean we have to go to a async config file again.

Thoughts?

Comment on lines +140 to +142
db: process.env.DATABASE_URI
? mongooseAdapter(dbOptions())
: sqliteAdapter({ client: { url: "file:./payload.db" } }),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should toggle based on a dedicated env variable (perhaps env.DATABASE_BACKEND === 'mongodb' or even some form of env.WCA_STAGING_BACKEND being set to any truthy value?) instead of "guessing" whether DATABASE_URI is set or not.

If you do implement this change, then you can actually pass env.DATABASE_URI to client.url in the Sqlite adapter config (of course assuming that you pass it a sensible value in dev:staging runner in package.json)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants