-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanity.config.ts
93 lines (89 loc) · 2.19 KB
/
sanity.config.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import { visionTool } from '@sanity/vision';
import { AuthConfig, defineConfig, definePlugin } from 'sanity';
import { deskTool } from 'sanity/desk';
import { customPublishAction } from './actions/customPublishAction';
import { structure } from './config/deskStructure';
import { schemaTypes } from './schemas/schema';
import { Dataset, PROSJEKT_ID } from './util/constants';
const sharedConfig = definePlugin({
name: 'shareConfig',
plugins: [deskTool({ structure }), visionTool()],
schema: {
types: schemaTypes,
},
});
const auth: AuthConfig = {
redirectOnSingle: true,
providers: () => [
{
name: 'saml',
title: 'NAV SSO',
url: 'https://api.sanity.io/v2021-10-01/auth/saml/login/f3270b37',
logo: '/static/navlogo.svg',
},
],
loginMethod: 'dual',
};
export default defineConfig([
{
name: 'prod',
title: 'Produksjon',
projectId: PROSJEKT_ID,
dataset: Dataset.PROD,
basePath: `/${Dataset.PROD}`,
plugins: [sharedConfig()],
auth: auth,
},
{
name: 'prod-v2',
title: 'Produksjon-v2',
projectId: PROSJEKT_ID,
dataset: Dataset.PROD_V2,
basePath: `/${Dataset.PROD_V2}`,
plugins: [sharedConfig()],
auth: auth,
},
{
name: 'test',
title: 'Test',
projectId: PROSJEKT_ID,
dataset: Dataset.TEST,
basePath: `/${Dataset.TEST}`,
plugins: [sharedConfig()],
auth: auth,
document: {
actions: prev =>
prev.map(originalAction =>
originalAction.action === 'publish'
? customPublishAction(originalAction)
: originalAction,
),
},
},
{
name: 'ba-prod',
title: 'BA - Produksjon',
projectId: PROSJEKT_ID,
dataset: Dataset.BA_PROD,
basePath: `/${Dataset.BA_PROD}`,
plugins: [sharedConfig()],
auth: auth,
},
{
name: 'ba-test',
title: 'BA - Test',
projectId: PROSJEKT_ID,
dataset: Dataset.BA_TEST,
basePath: `/${Dataset.BA_TEST}`,
plugins: [sharedConfig()],
auth: auth,
document: {
actions: prev =>
prev.map(originalAction =>
originalAction.action === 'publish'
? customPublishAction(originalAction)
: originalAction,
),
},
},
]);