-
Notifications
You must be signed in to change notification settings - Fork 2
/
keystone.ts
33 lines (31 loc) · 926 Bytes
/
keystone.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { config } from '@keystone-next/keystone/schema';
import { statelessSessions, withItemData } from '@keystone-next/keystone/session';
import { createAuth } from '@keystone-next/auth';
import { lists } from './schema';
import { PORT, DATABASE_URL, SESSION_MAX_AGE, SESSION_SECRET } from './config';
// createAuth configures signin functionality
const { withAuth } = createAuth({
listKey: 'Person',
identityField: 'email',
secretField: 'password',
initFirstItem: {
fields: ['name', 'email', 'password'],
itemData: { isAdmin: true },
},
});
// Configure the Keystone app
export default withAuth(
config({
db: {
provider: 'postgresql',
useMigrations: true,
url: DATABASE_URL,
},
server: { port: PORT },
lists,
ui: {},
session: withItemData(statelessSessions({ maxAge: SESSION_MAX_AGE, secret: SESSION_SECRET }), {
Person: 'name isAdmin',
}),
})
);