-
Notifications
You must be signed in to change notification settings - Fork 0
/
keystone.ts
54 lines (45 loc) · 1.73 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
53
/*
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';
import { statelessSessions } from '@keystone-6/core/session';
import 'dotenv/config'
// 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 } from './auth';
const session = statelessSessions({
secret: process.env.SESSION_SECRET || "There should be a secret here!",
maxAge: 60 * 60 * 8,
secure: true,
})
export default withAuth(
// Using the config function helps typescript guide you to the available options.
config({
server: {
port: 5000,
cors: { origin: ['http://127.0.0.1:3000', 'http://localhost:3000', 'https://farmcityfeed.com'], credentials: true},
},
// the db sets the database provider - we're using sqlite for the fastest startup experience
db: {
provider: 'postgresql',
url: `postgres://${process.env.DB_URL}`,
},
// 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,
images: {
upload: 'local',
local: {
storagePath: 'public/images',
baseUrl: '/images'
}
},
})
);