-
Notifications
You must be signed in to change notification settings - Fork 0
/
keystone.ts
45 lines (39 loc) · 1.5 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
37
38
39
40
41
42
43
44
45
/*
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: "sqlite",
url: "file:./keystone.db",
},
// 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,
storage: {
images: {
kind: "local",
type: "image",
generateUrl: (path) => `/images${path}`,
// The route that will be created in Keystone's backend to serve the images
serverRoute: {
path: "/images",
},
storagePath: ".data/images",
},
},
})
);