-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
69 lines (65 loc) · 1.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
const {PHASE_DEVELOPMENT_SERVER} = require('next/constants');
const {
JWT_SECRET = 'change-this-secret',
MONGODB_URI = '',
SES_HOST = 'email-smtp.eu-central-1.amazonaws.com',
SES_PORT = '465',
SES_USER = '',
SES_PASSWD = '',
APP_URL = 'https://app.analytodon.com',
MARKETING_URL = 'https://www.analytodon.com',
SUPPORT_EMAIL = '[email protected]',
EMAIL_SENDER_NAME = 'Analytodon',
EMAIL_API_KEY = '',
} = process.env;
module.exports = (phase) => {
let config = {
reactStrictMode: true,
swcMinify: true,
serverRuntimeConfig: {
jwtSecret: JWT_SECRET,
mongodbUri: MONGODB_URI,
mongodbOpts: {
tls: true,
tlsAllowInvalidCertificates: true,
retryWrites: false,
},
nodemailerTransport: {
host: SES_HOST,
port: parseInt(SES_PORT),
secure: true,
auth: {
user: SES_USER,
pass: SES_PASSWD,
},
},
emailAPIKey: EMAIL_API_KEY,
},
publicRuntimeConfig: {
debug: false,
marketingURL: MARKETING_URL,
appURL: APP_URL,
supportEmail: SUPPORT_EMAIL,
emailSenderName: EMAIL_SENDER_NAME,
},
};
if (phase === PHASE_DEVELOPMENT_SERVER) {
config = {
...config,
serverRuntimeConfig: {
...config.serverRuntimeConfig,
mongodbUri: 'mongodb://localhost',
mongodbOpts: {useNewUrlParser: true, useUnifiedTopology: true, dbName: 'analytodon'},
nodemailerTransport: {
sendmail: true,
},
},
publicRuntimeConfig: {
...config.publicRuntimeConfig,
debug: true,
appURL: 'http://localhost:3000',
},
};
}
return config;
};