forked from 21gifts/app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
68 lines (64 loc) · 2.11 KB
/
Copy pathnext.config.ts
File metadata and controls
68 lines (64 loc) · 2.11 KB
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
import type { NextConfig } from 'next';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const appRoot = path.dirname(fileURLToPath(import.meta.url));
function appVersionForBuild(): string {
const raw = process.env.NEXT_PUBLIC_APP_VERSION ?? process.env.APP_VERSION ?? 'dev';
if (raw === '') return 'dev';
return raw; // no 7-char slice
}
/**
* `output: 'standalone'` makes `next build` emit a self-contained server
* under `.next/standalone` — that is what the Dockerfile runtime stage ships.
* `outputFileTracingRoot` pins that layout to this package even when a parent
* directory also has a lockfile (Next would otherwise nest standalone).
*/
const nextConfig: NextConfig = {
output: 'standalone',
outputFileTracingRoot: appRoot,
outputFileTracingIncludes: {
'/handbook': ['./docs/handbook/**/*'],
'/handbook/screens': ['./docs/handbook/**/*', './scripts/screen-variants.mjs'],
'/handbook/functions': ['./docs/handbook/**/*'],
'/handbook/endpoints': ['./docs/handbook/**/*'],
},
env: {
NEXT_PUBLIC_APP_VERSION: appVersionForBuild(),
},
async redirects() {
return [
{
source: '/',
has: [{ type: 'header', key: 'x-forwarded-proto', value: 'http' }],
destination: 'https://21.gifts/',
permanent: true,
},
{
source: '/:path*',
has: [{ type: 'header', key: 'x-forwarded-proto', value: 'http' }],
destination: 'https://21.gifts/:path*',
permanent: true,
},
{ source: '/legal.html', destination: '/legal', permanent: true },
];
},
async headers() {
const hsts = {
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
};
return [
{
source: '/.well-known/nostr.json',
headers: [{ key: 'Access-Control-Allow-Origin', value: '*' }],
},
{
source: '/.well-known/lnurlp/:username',
headers: [{ key: 'Access-Control-Allow-Origin', value: '*' }],
},
{ source: '/', headers: [hsts] },
{ source: '/:path*', headers: [hsts] },
];
},
};
export default nextConfig;