π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web] Use the preferred null coalescing operator for env override
Manav Rathie23ac45fb3d7
diff --git a/web/apps/photos/.env b/web/apps/photos/.envindex 766c3b861e..fe626d52d6 100644--- a/web/apps/photos/.env+++ b/web/apps/photos/.env@@ -43,11 +43,11 @@# The URL of the accounts app#-# NEXT_PUBLIC_ENTE_ACCOUNTS_URL = http://localhost:3001+# NEXT_PUBLIC_ENTE_ACCOUNTS_URL = http://localhost:3001# The URL of the payments app#-# NEXT_PUBLIC_ENTE_PAYMENTS_URL = http://localhost:3001+# NEXT_PUBLIC_ENTE_PAYMENTS_URL = http://localhost:3001# The URL for the shared albums deployment#diff --git a/web/packages/shared/network/api.ts b/web/packages/shared/network/api.tsindex 6ce97a786d..f708e29e04 100644--- a/web/packages/shared/network/api.ts+++ b/web/packages/shared/network/api.ts@@ -3,28 +3,22 @@* API requests to museum.** This defaults to "https://api.ente.io", Ente's own servers, but can be- * overridden when self hosting by setting the `NEXT_PUBLIC_ENTE_ENDPOINT`- * environment variable.+ * overridden when self hosting or developing by setting the+ * `NEXT_PUBLIC_ENTE_ENDPOINT` environment variable.*/-export const apiOrigin = () => customAPIOrigin() || "https://api.ente.io";+export const apiOrigin = () => customAPIOrigin() ?? "https://api.ente.io";/*** Return the overridden API origin, if one is defined by setting the- * `NEXT_PUBLIC_ENTE_ENDPOINT` environment variable to a non-empty value.+ * `NEXT_PUBLIC_ENTE_ENDPOINT` environment variable.** Otherwise return undefined.*/export const customAPIOrigin = () =>- process.env.NEXT_PUBLIC_ENTE_ENDPOINT || undefined;+ process.env.NEXT_PUBLIC_ENTE_ENDPOINT ?? undefined;/** Deprecated, use {@link apiOrigin} instead. */-export const getEndpoint = () => {- const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;- if (endpoint) {- return endpoint;- }- return "https://api.ente.io";-};+export const getEndpoint = apiOrigin;export const getUploadEndpoint = () => {const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;@@ -39,10 +33,10 @@ export const getUploadEndpoint = () => {** Defaults to our production instance, "https://accounts.ente.io", but can be* overridden by setting the `NEXT_PUBLIC_ENTE_ACCOUNTS_URL` environment- * variable to a non-empty value.+ * variable.*/export const accountsAppURL = () =>- process.env.NEXT_PUBLIC_ENTE_ACCOUNTS_URL || `https://accounts.ente.io`;+ process.env.NEXT_PUBLIC_ENTE_ACCOUNTS_URL ?? `https://accounts.ente.io`;export const getAlbumsURL = () => {const albumsURL = process.env.NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT;