add option to override NEXT_PUBLIC_DISABLE_CF_UPLOAD_PROXY locally for testing

This commit is contained in:
Abhinav 2023-10-10 15:51:43 +05:30
parent ffdf7b65b5
commit 87aac09f56
2 changed files with 11 additions and 2 deletions

View file

@ -1,5 +1,9 @@
import { PAGES } from 'constants/pages';
import { getEndpoint, getFamilyPortalURL } from 'utils/common/apiUtil';
import {
getEndpoint,
getFamilyPortalURL,
isDevDeployment,
} from 'utils/common/apiUtil';
import { clearKeys } from 'utils/storage/sessionStorage';
import router from 'next/router';
import { clearData, getData, LS_KEYS } from 'utils/storage/localStorage';
@ -526,6 +530,11 @@ export const updateMapEnabledStatus = async (newStatus: boolean) => {
export async function getDisableCFUploadProxyFlag(): Promise<boolean> {
try {
const disableCFUploadProxy =
process.env.NEXT_PUBLIC_DISABLE_CF_UPLOAD_PROXY;
if (isDevDeployment() && typeof disableCFUploadProxy !== 'undefined') {
return disableCFUploadProxy === 'true';
}
const featureFlags = (
await fetch('https://static.ente.io/feature_flags.json')
).json() as GetFeatureFlagResponse;

View file

@ -99,7 +99,7 @@ It's a dev deployment (and should use the environment override for endpoints ) i
3. if the app is running locally (hence node_env is development)
4. if the app is running in test mode
*/
const isDevDeployment = () => {
export const isDevDeployment = () => {
if (globalThis?.location) {
return (
process.env.NEXT_PUBLIC_ENTE_WEB_ENDPOINT ===