Namespace vars

This commit is contained in:
Manav Rathi 2024-02-10 15:51:05 +05:30
parent fc695eff75
commit 1dac60aeb2
2 changed files with 25 additions and 31 deletions

View file

@ -18,24 +18,23 @@
# when the bundle is built). See
# https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables
#
# By default, the app is configured to connect to the production APIs. This is
# usually a good default, for example someone might want to run the client
# locally but still use their actual ente account.
# A development build behaves differently in some aspects:
#
# However, in other aspects it (by default) behaves like a development build
# when executed using `yarn dev:foo`:
# 1. Logs go to the browser console (in addition to the log file).
#
# 1. Logs go to the browser console instead of the log file
# 2. Sentry crash reports go to a separate project.
#
# 2. Sentry crash reporting etc is disabled
#
# See `isDevBuild` for the exact rules for determining what counts as a
# development build.
# Note that even in development build, the app still connects to the production
# APIs by default. This is usually a good default, for example someone might
# want to run the client locally but still use their actual ente account. This
# can be customized by using some of the environment variables below.
# The ente API endpoint
# NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:3000
# The Ente API endpoint
#
# NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:3000
# The ente API endpoint for payments related functionality
# The Ente API endpoint for payments related functionality
#
# NEXT_PUBLIC_ENTE_PAYMENT_ENDPOINT = http://localhost:3001
# The URL for the shared albums deployment
@ -44,6 +43,7 @@
# deploying, we add an a CNAME alias from "albums.ente.io" -> "/shared-album".
#
# Enhancement: Consider splitting this into a separate app/ in this repository.
#
# NEXT_PUBLIC_ENTE_ALBUM_ENDPOINT = http://localhost:3002
# The URL of the family plans web app deployment
@ -53,25 +53,26 @@
# these pages.
#
# Enhancement: Consider moving that into the app/ folder in this repository.
#
# NEXT_PUBLIC_ENTE_FAMILY_PORTAL_ENDPOINT = http://localhost:3003
# Set this to true to disable reporting of crashes to Sentry.
#
# Crash reporting is disabled if the user has opted out. This provides another
# way to disable crash reporting, say for local test branches.
#
# NEXT_PUBLIC_DISABLE_SENTRY=true
# Set this to true to disable the upload of files via CF Workers
# Set this to "true" to disable the upload of files of Cloudflare Workers.
#
# CF workers provide us with a way of make the file uploads faster. The why and
# how is explained here: https://ente.io/blog/tech/making-uploads-faster/
# These workers were introduced as a way of make the file uploads faster
# https://ente.io/blog/tech/making-uploads-faster/
#
# By default, that's the route we take. This flag can be set to true to disable
# that and instead directly upload to the S3-compatible URLs returned by the
# ente API.
# By default, that's the route we take. However, during development it can be
# convenient to turn this flag on and instead directly upload to the
# S3-compatible URLs returned by the ente API.
#
# Mind the double negative.
# NEXT_PUBLIC_DISABLE_CF_UPLOAD_PROXY = true
# NEXT_PUBLIC_ENTE_DIRECT_UPLOAD = true
# The path of the JSON file which contains the expected results of our
# integration tests. See `upload.test.ts` for more details.

View file

@ -1,8 +1,4 @@
import {
getEndpoint,
getFamilyPortalURL,
isDevBuild,
} from '@ente/shared/network/api';
import { getEndpoint, getFamilyPortalURL } from '@ente/shared/network/api';
import { getData, LS_KEYS } from '@ente/shared/storage/localStorage';
import localForage from '@ente/shared/storage/localForage';
import { getToken } from '@ente/shared/storage/localStorage/helpers';
@ -323,12 +319,9 @@ export const updateMapEnabledStatus = async (newStatus: boolean) => {
};
export async function getDisableCFUploadProxyFlag(): Promise<boolean> {
if (process.env.NEXT_PUBLIC_ENTE_DIRECT_UPLOAD === 'true') return true;
try {
const disableCFUploadProxy =
process.env.NEXT_PUBLIC_DISABLE_CF_UPLOAD_PROXY;
if (isDevBuild() && typeof disableCFUploadProxy !== 'undefined') {
return disableCFUploadProxy === 'true';
}
const featureFlags = (
await fetch('https://static.ente.io/feature_flags.json')
).json() as GetFeatureFlagResponse;