-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeystone.ts
36 lines (30 loc) · 1.33 KB
/
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
34
35
36
/*
Welcome to Keystone! This file is what keystone uses to start the app.
It looks at the default export, and expects a Keystone config object.
You can find all the config options in our docs here: https://keystonejs.com/docs/apis/config
*/
import { config } from "@keystone-6/core";
// Look in the schema file for how we define our lists, and how users interact with them through graphql or the Admin UI
import { lists } from "./schema";
// Keystone auth is configured separately - check out the basic auth setup we are importing from our auth file.
import { withAuth, session } from "./auth";
export default withAuth(
// Using the config function helps typescript guide you to the available options.
config({
// the db sets the database provider - we're using sqlite for the fastest startup experience
db: {
provider: "postgresql",
url: process.env.DATABASE_URL || "postgres://ducntq:9988776655@localhost:5432/cms",
enableLogging: true,
useMigrations: true,
idField: { kind: "uuid" },
},
// This config allows us to set up features of the Admin UI https://keystonejs.com/docs/apis/config#ui
ui: {
// For our starter, we check that someone has session data before letting them see the Admin UI.
isAccessAllowed: (context) => !!context.session?.data,
},
lists,
session,
})
);