-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
88 lines (78 loc) · 2.44 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
/*
* Gets the APP_BASE_PATH from the command used to start this app.
* If APP_BASE_PATH is specified but it does not start with a "/"
* then add it.
*/
function getBasePath() {
var basePath = ''
if (process.env.APP_BASE_PATH) {
if (process.env.APP_BASE_PATH.startsWith("/")) {
basePath = process.env.APP_BASE_PATH;
} else {
basePath = "/" + process.env.APP_BASE_PATH;
}
}
return basePath
}
function getProtocol() {
return (process.env.PROTOCOL && process.env.PROTOCOL == 'https') ? 'https' : 'http';
}
// Override OAuth2 endpoint and client config in the dev environment
function getOAuthClients() {
const clients_dev = {
"cart": {
id: '79ec9a31-1e21-4458-bf99-3e8ee82b3ab7',
secret: 'buU5MOorZ2UZk48HlqNmW_zoE',
scope: 'openid offline email profile consumer.audience consumer.tier'
},
}
const clients_prod = {
"cart": {
id: '85950f8c-41eb-4559-a543-c2fbc3a19690',
secret: '5IGNEM8FZrMWpGeP~l.WtsARrs',
scope: 'openid offline email profile consumer.audience consumer.tier'
},
}
return (process.env.CLOUD_ENV === 'dev') ? clients_dev : clients_prod;
}
function getOAuthUrl() {
const url_dev = "https://fervent-dewdney-gqdkbt8xn7.projects.oryapis.com";
const url_prod = "https://idp.wesaluteapis.com";
return (process.env.CLOUD_ENV === 'dev') ? url_dev : url_prod;
}
function getUserInfoUrl() {
const url_dev = "https://account-dev.wesaluteapis.com/userinfo";
const url_prod = "https://account.wesaluteapis.com/userinfo";
return (process.env.CLOUD_ENV === 'dev') ? url_dev : url_prod;
}
function getwidgetUrl() {
const url_dev = "https://connections-dev.wesaluteapis.com/loader/bc.js";
const url_prod = "https://connections.wesaluteapis.com/loader/bc.js";
return (process.env.CLOUD_ENV === 'dev') ? url_dev : url_prod;
}
module.exports = {
reactStrictMode: true,
basePath: getBasePath(),
publicRuntimeConfig: {
basePath: getBasePath(),
protocol: getProtocol(),
},
//When this app runs in the WeSalute dev environment, we will connect
//to the dev instance of all external services
serverRuntimeConfig: {
clients: getOAuthClients(),
oauthUrl: getOAuthUrl(),
userInfoUrl: getUserInfoUrl(),
widgetUrl: getwidgetUrl()
},
// Path rewrites config
async rewrites() {
return [
// Standard healthcheck endpoint (/healthz)
{
source: '/healthz',
destination: '/api/healthz',
},
]
},
}