mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 05:18:34 +03:00
Add API proxy (#41)
This commit is contained in:
@@ -199,5 +199,6 @@
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
}
|
||||
},
|
||||
"proxy": "https://ukraine.bellingcat.com/ukraine-server"
|
||||
}
|
||||
|
||||
@@ -268,14 +268,15 @@ export function injectSource(id) {
|
||||
};
|
||||
}
|
||||
|
||||
const API_ROOT =
|
||||
process.env.NODE_ENV === "development" ? "" : process.env.SERVER_ROOT;
|
||||
|
||||
export function urlFromEnv(ext) {
|
||||
if (process.env[ext]) {
|
||||
if (!Array.isArray(process.env[ext])) {
|
||||
return [`${process.env.SERVER_ROOT}${process.env[ext]}`];
|
||||
return [`${API_ROOT}${process.env[ext]}`];
|
||||
} else {
|
||||
return process.env[ext].map(
|
||||
(suffix) => `${process.env.SERVER_ROOT}${suffix}`
|
||||
);
|
||||
return process.env[ext].map((suffix) => `${API_ROOT}${suffix}`);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user