forked from DBCDK/bibliotekdk-next-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
151 lines (149 loc) · 3.99 KB
/
next.config.js
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
* @file
* This is the configuration file for Next.js.
*
* See https://nextjs.org/docs/api-reference/next.config.js/introduction
*
* We set distDir, such that the build folder is located next to the storybook build
*/
module.exports = {
distDir: "dist/next",
// headers: async () => {
// return [
// {
// source: "/_next/image:slug*",
// headers: [
// {
// key: "Cache-Control",
// value: "public, s-maxage=600",
// },
// ],
// },
// {
// source: "/img:slug*",
// headers: [
// {
// key: "Cache-Control",
// value: "public, s-maxage=600",
// },
// ],
// },
// ];
// },
i18n: {
locales: ["da", "en"],
defaultLocale: "da",
localeDetection: false,
},
images: {
domains: [
"forfatterweb.dk",
"bibdk-backend-www-master.febib-prod.svc.cloud.dbc.dk",
"bibdk-backend-www-master.febib-staging.svc.cloud.dbc.dk",
"bibdk-backend-www-master.frontend-staging.svc.cloud.dbc.dk",
],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384, 640, 1400],
},
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
});
return config;
},
async rewrites() {
return [
{
source: "/robots.txt",
destination: "/api/robots",
},
];
},
async redirects() {
return [
{
source: "/hj%C3%A6lp",
destination: "/hjaelp",
permanent: true,
},
{
source: "/help",
destination: "/hjaelp",
permanent: true,
},
{
source: "/inspiration/b%C3%B8ger",
destination: "/inspiration/boeger",
permanent: true,
},
{
source: "/inspiration/bøger",
destination: "/inspiration/boeger",
permanent: true,
},
{
source: "/was",
destination: "https://www.was.digst.dk/beta-bibliotek-dk",
permanent: false,
},
{
source: "/work/((?!work-of)):workId",
destination: "/materiale/titel_skaber/work-of%3A:workId",
permanent: true,
},
{
source: "/work/work-of:workId",
destination: "/materiale/titel_skaber/work-of:workId",
permanent: true,
},
{
source: "/work/pid/:pid",
destination: "/linkme.php/?rec.id=:pid",
permanent: true,
},
];
},
experimental: {
scrollRestoration: true,
},
serverRuntimeConfig: {
// Will only be available on the server side
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
jwtSecret: process.env.NEXTAUTH_SECRET,
disableDrupalTranslate: process.env.DISABLE_DRUPAL_TRANSLATE || false,
maxError500Count: process.env.MAX_ERROR_COUNT || 2,
allowRobots: process.env.ALLOW_ROBOTS === "true" ? true : false,
},
publicRuntimeConfig: {
cookiebot: {
id: process.env.COOKIEBOT_ID || "23672b99-380a-4179-99ce-12e0fdd759cb",
mode: process.env.COOKIEBOT_MODE || "auto",
},
elbaDryRun:
typeof process.env.ELBA_DRY_RUN === "undefined"
? true
: process.env.ELBA_DRY_RUN,
// Set to false in production. When set to true, the session id is set to "test", when collecting data.
// This allow AI to remove entries with session_id=test
useFixedSessionId:
typeof process.env.USE_FIXED_SESSION_ID === "undefined" ||
process.env.USE_FIXED_SESSION_ID !== "false" ||
!process.env.USE_FIXED_SESSION_ID,
fbi_api: {
url:
process.env.NEXT_PUBLIC_FBI_API_URL ||
"https://fbi-api-staging.k8s.dbc.dk/bibdk21/graphql",
timeout: process.env.API_TIMEOUT_MS || 150,
},
fbi_api_simplesearch: {
url:
process.env.NEXT_PUBLIC_FBI_API_SIMPLESEARCH_URL ||
"https://fbi-api-staging.k8s.dbc.dk/SimpleSearch/graphql",
timeout: process.env.API_TIMEOUT_MS || 150,
},
app: {
url: process.env.NEXTAUTH_URL,
},
},
};