Unconditionally use environment overrides

This commit is contained in:
Manav Rathi 2024-02-10 16:01:40 +05:30
parent 1dac60aeb2
commit 36e76626cd
3 changed files with 17 additions and 17 deletions

View file

@ -25,9 +25,9 @@
# 2. Sentry crash reports go to a separate project.
#
# 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.
# APIs by default (can be customized using the env vars below). This is usually
# a good default, for example a customer cloning this repository want to build
# and run the client from source but still use their actual Ente account.
# The Ente API endpoint
#

View file

@ -1,6 +1,6 @@
export const getEndpoint = () => {
const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;
if (isDevBuild() && endpoint) {
if (endpoint) {
return endpoint;
}
return 'https://api.ente.io';
@ -8,7 +8,7 @@ export const getEndpoint = () => {
export const getFileURL = (id: number) => {
const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;
if (isDevBuild() && endpoint) {
if (endpoint) {
return `${endpoint}/files/download/${id}`;
}
return `https://files.ente.io/?fileID=${id}`;
@ -16,7 +16,7 @@ export const getFileURL = (id: number) => {
export const getPublicCollectionFileURL = (id: number) => {
const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;
if (isDevBuild() && endpoint) {
if (endpoint) {
return `${endpoint}/public-collection/files/download/${id}`;
}
return `https://public-albums.ente.io/download/?fileID=${id}`;
@ -24,7 +24,7 @@ export const getPublicCollectionFileURL = (id: number) => {
export const getThumbnailURL = (id: number) => {
const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;
if (isDevBuild() && endpoint) {
if (endpoint) {
return `${endpoint}/files/preview/${id}`;
}
return `https://thumbnails.ente.io/?fileID=${id}`;
@ -32,15 +32,15 @@ export const getThumbnailURL = (id: number) => {
export const getPublicCollectionThumbnailURL = (id: number) => {
const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;
if (isDevBuild() && endpoint) {
if (endpoint) {
return `${endpoint}/public-collection/files/preview/${id}`;
}
return `https://public-albums.ente.io/preview/?fileID=${id}`;
};
export const getUploadEndpoint = () => {
const endpoint = process.env.NEXT_PUBLIC_ENTE_UPLOAD_ENDPOINT;
if (isDevBuild() && endpoint) {
const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;
if (endpoint) {
return endpoint;
}
return `https://uploader.ente.io`;
@ -48,7 +48,7 @@ export const getUploadEndpoint = () => {
export const getPaymentsURL = () => {
const paymentsURL = process.env.NEXT_PUBLIC_ENTE_PAYMENT_ENDPOINT;
if (isDevBuild() && paymentsURL) {
if (paymentsURL) {
return paymentsURL;
}
return `https://payments.ente.io`;
@ -56,17 +56,19 @@ export const getPaymentsURL = () => {
export const getAlbumsURL = () => {
const albumsURL = process.env.NEXT_PUBLIC_ENTE_ALBUM_ENDPOINT;
if (isDevBuild() && albumsURL) {
if (albumsURL) {
return albumsURL;
}
return `https://albums.ente.io`;
};
// getFamilyPortalURL returns the endpoint for the family dashboard which can be used to
// create or manage family.
/**
* Return the URL for the family dashboard which can be used to create or manage
* family plans.
*/
export const getFamilyPortalURL = () => {
const familyURL = process.env.NEXT_PUBLIC_ENTE_FAMILY_PORTAL_ENDPOINT;
if (isDevBuild() && familyURL) {
if (familyURL) {
return familyURL;
}
return `https://family.ente.io`;

View file

@ -36,9 +36,7 @@ else
# development deployment.
export NODE_ENV=development
# Also, we connect all of them to the dev APIs.
export NEXT_PUBLIC_APP_ENV=development
export NEXT_PUBLIC_ENTE_ENDPOINT=https://dev-api.ente.io
export NEXT_PUBLIC_ENTE_WEB_ENDPOINT=https://dev-web.ente.io
export NEXT_PUBLIC_ENTE_ALBUM_ENDPOINT=https://dev-albums.ente.io
yarn export:photos