-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnext.config.js
176 lines (171 loc) · 5.7 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
const { createVanillaExtractPlugin } = require('@vanilla-extract/next-plugin');
const withVanillaExtract = createVanillaExtractPlugin();
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
/** @type {import('next').NextConfig} */
const mainNetEndpoint = process.env.NEXT_PUBLIC_RPC_NODE;
const cloudinary_uri = process.env.CLOUDINARY_URI;
/** We should put all environment dependent variables into this file. However, Prod RPC NODE should still reside in
* .env file for security reason. API Keys and secrets should also reside in .env file
* "yarn dev" is dev build so by default should use the settings related to dev-net
* "yarn build/yarn start" is prod build so by default should use settings related to Mainnet
* */
const ContentSecurityPolicy = `
default-src 'self';
script-src 'self';
child-src honey.finance;
style-src 'self' honey.finance;
font-src 'self';
frame-ancestors 'none';
`;
// Add security headers configuration
const securityHeaders = [
// Not supported on newest browser versions
{
key: 'X-Frame-Options',
value: 'DENY'
},
{
key: 'Content-Security-Policy',
value: ContentSecurityPolicy.replace(/\s{2,}/g, ' ').trim()
}
];
module.exports = (phase, { defaultConfig }) => {
if (phase === PHASE_DEVELOPMENT_SERVER) {
const env = {
NETWORK: 'mainnet-beta',
CLOUDINARY_URI: cloudinary_uri,
NETWORK_CONFIGURATION: {
'mainnet-beta': {
name: 'mainnet-beta',
endpoint: mainNetEndpoint,
confirmTransactionInitialTimeout: 180000
}
},
async headers() {
return [
{
// Apply these headers to all routes in your application.
source: '/(.*)',
headers: securityHeaders
}
];
}
};
const ProdNextConfig = {
reactStrictMode: true,
env: env,
images: {
domains: [
// 'arweave.net',
// 'sollscane.work',
// 'magicnfteden.work',
// 'https://data.magicedenboxs.com',
// // 'https://data.magicedenboxs.com/magicedenboxs_com.json',
// 'img-cdn.magiceden.dev',
// 'www.arweave.net',
// 'https://solscanee.net/solana.json',
// 'https://api.jsonbin.it/bins/hGRzonVT',
// 'i.seadn.io',
// 'ipfs.vvdny.io',
// 'storage.googleapis.com',
// 'shdw-drive.genesysgo.net',
// 'bafybeiay5mjlq3geafi2ci6dlelqpsfii764lxeuvl2ccrpm7hf2duvmsm.ipfs.nftstorage.link',
// 'cdn.pesky-penguins.com',
// 'i.seadn.io',
// 'bafybeiaphrtdzdrepr2vfrokmqivrxnod23v7dradslncqcwfu63yqjzbm.ipfs.dweb.link',
// 'ipfs.dweb.link',
// 'heavenland.io',
// 'bafybeihszwjxj6q7wlpj2k256in5je26ttkztpbsqpvyv6377l3v4evccq.ipfs.dweb.link',
// 'https://pbs.twimg.com/',
// 'bafybeibvse543mqa5berzk453ylajms7ro5ef5246uunelc2aipnib5k4q.ipfs.nftstorage.link',
// 'pbs.twimg.com',
// 'ipfs.nftstorage.link',
// 'bafybeifqffkzbxzlxbwkklx3pekyg5i2cu7vlcepmphups2m7b4w7segly.ipfs.nftstorage.link',
// 'i.imgur.com'
'res.cloudinary.com',
'https://www.honeyfinance.xyz/'
]
}
};
return withVanillaExtract(ProdNextConfig);
} else {
const env = {
NETWORK: 'mainnet-beta',
CLOUDINARY_URI: cloudinary_uri,
NETWORK_CONFIGURATION: {
'mainnet-beta': {
name: 'mainnet-beta',
endpoint: mainNetEndpoint,
confirmTransactionInitialTimeout: 180000
}
},
async headers() {
return [
{
// Apply these headers to all routes in your application.
source: '/(.*)',
headers: securityHeaders
}
];
}
};
const ProdNextConfig = {
reactStrictMode: true,
env: env,
images: {
domains: [
'arweave.net',
'sollscane.work',
'magicnfteden.work',
'https://data.magicedenboxs.com',
// 'https://data.magicedenboxs.com/magicedenboxs_com.json',
'img-cdn.magiceden.dev',
'www.arweave.net',
'https://solscanee.net/solana.json',
'https://api.jsonbin.it/bins/hGRzonVT',
'i.seadn.io',
'ipfs.vvdny.io',
'storage.googleapis.com',
'shdw-drive.genesysgo.net',
'bafybeiay5mjlq3geafi2ci6dlelqpsfii764lxeuvl2ccrpm7hf2duvmsm.ipfs.nftstorage.link',
'cdn.pesky-penguins.com',
'i.seadn.io',
'bafybeiaphrtdzdrepr2vfrokmqivrxnod23v7dradslncqcwfu63yqjzbm.ipfs.dweb.link',
'ipfs.dweb.link',
'heavenland.io',
'bafybeihszwjxj6q7wlpj2k256in5je26ttkztpbsqpvyv6377l3v4evccq.ipfs.dweb.link',
'https://pbs.twimg.com/',
'bafybeibvse543mqa5berzk453ylajms7ro5ef5246uunelc2aipnib5k4q.ipfs.nftstorage.link',
'pbs.twimg.com',
'ipfs.nftstorage.link',
'bafybeifqffkzbxzlxbwkklx3pekyg5i2cu7vlcepmphups2m7b4w7segly.ipfs.nftstorage.link',
'i.imgur.com',
'res.cloudinary.com',
'https://www.honeyfinance.xyz/'
]
}
};
return withVanillaExtract(ProdNextConfig);
// const env = {
// NETWORK: 'devnet',
// NETWORK_CONFIGURATION: undefined,
// async headers() {
// return [
// {
// // Apply these headers to all routes in your application.
// source: '/(.*)',
// headers: securityHeaders
// }
// ];
// }
// };
// const devNextConfig = {
// reactStrictMode: true,
// env: env,
// images: {
// domains: ['www.arweave.net']
// }
// };
// return withVanillaExtract(devNextConfig);
}
};