Create new admin user
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
tobias 2024-07-05 23:26:50 +02:00
parent a27c335113
commit 3d4499fb80

View File

@ -60,14 +60,14 @@ export default buildConfig({
async onInit(payload) { async onInit(payload) {
const existingUsers = await payload.find({ const existingUsers = await payload.find({
collection: 'users', collection: 'users',
limit: 1, limit: 2,
}) })
if (existingUsers.docs.length === 0) { if (existingUsers.docs.length === 0 || existingUsers.docs.length === 1) {
await payload.create({ await payload.create({
collection: 'users', collection: 'users',
data: { data: {
email: 'dev@payloadcms.com', email: 'admin@nextload.test',
password: 'test', password: 'test',
roles: ['admin'], roles: ['admin'],
}, },