-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
82 lines (77 loc) · 2.31 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
const {
PHASE_DEVELOPMENT_SERVER,
PHASE_PRODUCTION_BUILD,
} = require("next/constants");
// This uses phases as outlined here: https://nextjs.org/docs/#custom-configuration
module.exports = (phase) => {
// when started in development mode `next dev` or `npm run dev` regardless of the value of STAGING environmental variable
const isDev = phase === PHASE_DEVELOPMENT_SERVER;
// when `next build` or `npm run build` is used
const isProd =
phase === PHASE_PRODUCTION_BUILD && process.env.STAGING !== "1";
// when `next build` or `npm run build` is used
const isStaging =
phase === PHASE_PRODUCTION_BUILD && process.env.STAGING === "1";
console.log(`isDev:${isDev} isProd:${isProd} isStaging:${isStaging}`);
const env = {
BACKEND_URL: (() => {
if (isDev) return "http://localhost:25500/graphql";
if (isStaging) return "http://localhost:25500/graphql";
if (isProd) return "http://localhost:25500/graphql";
})(),
API_BASE_URL: (() => {
if (isDev) return "http://localhost:25500";
if (isStaging) return "http://localhost:25500";
if (isProd) return "http://localhost:25500";
})(),
PGUSER: "postgres",
PGPASSWORD: "postgres",
PGHOST: "localhost",
PGPORT: "5432",
PGDATABASE: "enterprise",
APPNAME: (() => {
if (isDev) return "EMBER";
if (isStaging) return "EMBER";
if (isProd) return "EMBER";
})(),
};
// {
// "development": {
// "username": "postgres",
// "password": "postgres",
// "database": "enterprise",
// "host": "127.0.0.1",
// "dialect": "postgres",
// "define": {
// "freezeTableName": true,
// "timestamps": false
// }
// },
// "test": {
// "username": "root",
// "password": null,
// "database": "database_test",
// "host": "127.0.0.1",
// "dialect": "mysql"
// },
// "production": {
// "username": "root",
// "password": null,
// "database": "emberreact",
// "host": "160.20.10.2",
// "dialect": "mysql",
// "define": {
// "freezeTableName": true,
// "timestamps": false
// },
// "logging": false
// }
// }
// next.config.js object
return {
env,
serverRuntimeConfig: {
JWT_SECRET: "1qazxsw23edcvfr45tgb",
},
};
};