-
Notifications
You must be signed in to change notification settings - Fork 0
/
keystone.ts
52 lines (46 loc) · 1.9 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
46
47
48
49
50
51
52
/*
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({
storage: {
my_local_images: {
// Images that use this store will be stored on the local machine
kind: 'local',
// This store is used for the image field type
type: 'image',
// The URL that is returned in the Keystone GraphQL API
// generateUrl: (path) => `${baseUrl}/images${path}`,
generateUrl: (path) => `/images${path}`,
// The route that will be created in Keystone's backend to serve the images
serverRoute: {
path: '/images',
},
// Set serverRoute to null if you don't want a route to be created in Keystone
// serverRoute: null
storagePath: 'public/images',
},
/** more storage */
},
// 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,
}),
)