-
Notifications
You must be signed in to change notification settings - Fork 67
/
setupProxy.js
33 lines (29 loc) · 1.11 KB
/
setupProxy.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
/*
Copyright 2022 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in
accordance with the terms of the Adobe license agreement accompanying
it.
*/
const { SERVICE_TOKEN, DEV_TOKEN, BASIC } = require('./proxy/authMethods');
const proxy = (() => {
switch (process.env.REACT_APP_AUTH_METHOD) {
case SERVICE_TOKEN:
// Use Service token exchange for Cloud Env PROD
return require('./proxy/setupProxy.auth.service-token');
case DEV_TOKEN:
// Use Dev token for local development with Cloud Env
return require('./proxy/setupProxy.auth.dev-token');
case BASIC:
// Use user/pass for local development with Local Author Env
return require('./proxy/setupProxy.auth.basic');
default:
// Auth not needed for local development with Local Publisher Env
return require('./proxy/setupProxy.auth.none');
}
})();
/*
Set up a proxy with AEM for local development
In a production environment this proxy should be set up at the webserver level or absolute URLs should be used.
*/
module.exports = proxy;