-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
27 lines (24 loc) · 901 Bytes
/
Copy pathnext.config.ts
File metadata and controls
27 lines (24 loc) · 901 Bytes
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
import type { NextConfig } from 'next';
import { readFileSync } from 'fs';
import { join } from 'path';
// Pobieramy wersję z package.json podczas buildu
const packageJsonPath = join(process.cwd(), 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
const nextConfig: NextConfig = {
env: {
NEXT_PUBLIC_APP_VERSION: packageJson.version,
},
async headers() {
const corsHeaders = [
{ key: 'Access-Control-Allow-Origin', value: '*' },
{ key: 'Access-Control-Allow-Methods', value: 'GET, POST, OPTIONS' },
{ key: 'Access-Control-Allow-Headers', value: 'Content-Type, Authorization' },
];
return [
{ source: '/api/health', headers: corsHeaders },
{ source: '/api/v1/projects/claim', headers: corsHeaders },
{ source: '/api/v1/public/:path*', headers: corsHeaders },
];
},
};
export default nextConfig;