Skip to content

The open alternative to Salesforce, designed for AI.

Delete auth/file front variables (#4455)

Félix Malfaitb6e8bb1a6cdc
diff --git a/packages/twenty-docker/prod/twenty-front/Dockerfile b/packages/twenty-docker/prod/twenty-front/Dockerfile
index 9b8c200c3b2..7480b7e1c3a 100644
--- a/packages/twenty-docker/prod/twenty-front/Dockerfile
+++ b/packages/twenty-docker/prod/twenty-front/Dockerfile
@@ -1,8 +1,6 @@
FROM node:18.17.1-alpine as twenty-front-build
ARG REACT_APP_SERVER_BASE_URL
-ARG REACT_APP_SERVER_AUTH_URL
-ARG REACT_APP_SERVER_FILES_URL
WORKDIR /app
diff --git a/packages/twenty-docs/docs/start/self-hosting/cloud-providers.mdx b/packages/twenty-docs/docs/start/self-hosting/cloud-providers.mdx
index 8250dfece6a..0eae5ff1a40 100644
--- a/packages/twenty-docs/docs/start/self-hosting/cloud-providers.mdx
+++ b/packages/twenty-docs/docs/start/self-hosting/cloud-providers.mdx
@@ -229,14 +229,6 @@ resource "azurerm_container_app" "twenty_front" {
name = "REACT_APP_SERVER_BASE_URL"
value = "https://${azurerm_container_app.twenty_server.ingress[0].fqdn}"
}
- env {
- name = "REACT_APP_SERVER_AUTH_URL"
- value = "https://${azurerm_container_app.twenty_server.ingress[0].fqdn}/auth"
- }
- env {
- name = "REACT_APP_SERVER_FILES_URL"
- value = "https://${azurerm_container_app.twenty_server.ingress[0].fqdn}/files"
- }
}
}
}
diff --git a/packages/twenty-docs/docs/start/self-hosting/docker-compose.mdx b/packages/twenty-docs/docs/start/self-hosting/docker-compose.mdx
index 928f74cafec..0204e30fb28 100644
--- a/packages/twenty-docs/docs/start/self-hosting/docker-compose.mdx
+++ b/packages/twenty-docs/docs/start/self-hosting/docker-compose.mdx
@@ -59,8 +59,6 @@ services:
environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- REACT_APP_SERVER_BASE_URL=${LOCAL_SERVER_URL}
- - REACT_APP_SERVER_AUTH_URL=${LOCAL_SERVER_URL}/auth
- - REACT_APP_SERVER_FILES_URL=${LOCAL_SERVER_URL}/files
depends_on:
- backend
diff --git a/packages/twenty-docs/docs/start/self-hosting/self-hosting.mdx b/packages/twenty-docs/docs/start/self-hosting/self-hosting.mdx
index 343c7aca0ed..29044fa5858 100644
--- a/packages/twenty-docs/docs/start/self-hosting/self-hosting.mdx
+++ b/packages/twenty-docs/docs/start/self-hosting/self-hosting.mdx
@@ -23,8 +23,6 @@ import TabItem from '@theme/TabItem';
<OptionTable options={[
['REACT_APP_SERVER_BASE_URL', 'http://localhost:3000', 'Url of backend server'],
- ['REACT_APP_SERVER_AUTH_URL', 'http://localhost:3000/auth', 'Auth Url of backend server'],
- ['REACT_APP_SERVER_FILES_URL', 'http://localhost:3000/files', 'Files Url of backend server'],
['GENERATE_SOURCEMAP', 'false', 'Generate source maps for debugging'],
['CHROMATIC_PROJECT_TOKEN', '', 'Chromatic token used for CI'],
]}></OptionTable>
diff --git a/packages/twenty-front/.env.example b/packages/twenty-front/.env.example
index e39840f2f67..423b00b0733 100644
--- a/packages/twenty-front/.env.example
+++ b/packages/twenty-front/.env.example
@@ -2,6 +2,4 @@ REACT_APP_SERVER_BASE_URL=http://localhost:3000
GENERATE_SOURCEMAP=false
# ———————— Optional ————————
-# REACT_APP_SERVER_AUTH_URL=http://localhost:3000/auth
-# REACT_APP_SERVER_FILES_URL=http://localhost:3000/files
# CHROMATIC_PROJECT_TOKEN=
diff --git a/packages/twenty-front/src/config/index.ts b/packages/twenty-front/src/config/index.ts
index f128fd760f7..1220a5b0a43 100644
--- a/packages/twenty-front/src/config/index.ts
+++ b/packages/twenty-front/src/config/index.ts
@@ -27,14 +27,4 @@ const getDefaultUrl = () => {
export const REACT_APP_SERVER_BASE_URL =
window._env_?.REACT_APP_SERVER_BASE_URL ||
process.env.REACT_APP_SERVER_BASE_URL ||
- getDefaultUrl();
-
-export const REACT_APP_SERVER_AUTH_URL =
- window._env_?.REACT_APP_SERVER_AUTH_URL ||
- process.env.REACT_APP_SERVER_AUTH_URL ||
- REACT_APP_SERVER_BASE_URL + '/auth';
-
-export const REACT_APP_SERVER_FILES_URL =
- window._env_?.REACT_APP_SERVER_FILES_URL ||
- process.env.REACT_APP_SERVER_FILES_URL ||
- REACT_APP_SERVER_BASE_URL + '/files';
+ getDefaultUrl();
\ No newline at end of file
diff --git a/packages/twenty-front/src/modules/auth/hooks/useAuth.ts b/packages/twenty-front/src/modules/auth/hooks/useAuth.ts
index d598b69806a..3ecd5271e5f 100644
--- a/packages/twenty-front/src/modules/auth/hooks/useAuth.ts
+++ b/packages/twenty-front/src/modules/auth/hooks/useAuth.ts
@@ -19,7 +19,7 @@ import { supportChatState } from '@/client-config/states/supportChatState';
import { telemetryState } from '@/client-config/states/telemetryState';
import { iconsState } from '@/ui/display/icon/states/iconsState';
import { ColorScheme } from '@/workspace-member/types/WorkspaceMember';
-import { REACT_APP_SERVER_AUTH_URL } from '~/config';
+import { REACT_APP_SERVER_BASE_URL } from '~/config';
import {
useChallengeMutation,
useCheckUserExistsLazyQuery,
@@ -204,9 +204,9 @@ export const useAuth = () => {
);
const handleGoogleLogin = useCallback((workspaceInviteHash?: string) => {
- const authServerUrl = REACT_APP_SERVER_AUTH_URL;
+ const authServerUrl = REACT_APP_SERVER_BASE_URL;
window.location.href =
- `${authServerUrl}/google/${
+ `${authServerUrl}/auth/google/${
workspaceInviteHash ? '?inviteHash=' + workspaceInviteHash : ''
}` || '';
}, []);
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx
index c8d80768143..9f891846bc8 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx
@@ -6,7 +6,7 @@ import { Button } from '@/ui/input/button/components/Button';
import { Card } from '@/ui/layout/card/components/Card';
import { CardContent } from '@/ui/layout/card/components/CardContent';
import { CardHeader } from '@/ui/layout/card/components/CardHeader';
-import { REACT_APP_SERVER_AUTH_URL } from '~/config';
+import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { useGenerateTransientTokenMutation } from '~/generated/graphql';
const StyledHeader = styled(CardHeader)`
@@ -30,14 +30,14 @@ export const SettingsAccountsListEmptyStateCard = ({
const [generateTransientToken] = useGenerateTransientTokenMutation();
const handleGmailLogin = useCallback(async () => {
- const authServerUrl = REACT_APP_SERVER_AUTH_URL;
+ const authServerUrl = REACT_APP_SERVER_BASE_URL;
const transientToken = await generateTransientToken();
const token =
transientToken.data?.generateTransientToken.transientToken.token;
- window.location.href = `${authServerUrl}/google-gmail?transientToken=${token}`;
+ window.location.href = `${authServerUrl}/auth/google-gmail?transientToken=${token}`;
}, [generateTransientToken]);
return (
diff --git a/packages/twenty-front/src/modules/users/utils/getProfilePictureAbsoluteURI.ts b/packages/twenty-front/src/modules/users/utils/getProfilePictureAbsoluteURI.ts
index 86f97c1df47..b38880af8fe 100644
--- a/packages/twenty-front/src/modules/users/utils/getProfilePictureAbsoluteURI.ts
+++ b/packages/twenty-front/src/modules/users/utils/getProfilePictureAbsoluteURI.ts
@@ -1,4 +1,4 @@
-import { REACT_APP_SERVER_FILES_URL } from '~/config';
+import { REACT_APP_SERVER_BASE_URL } from '~/config';
export const getImageAbsoluteURIOrBase64 = (imageUrl?: string | null) => {
if (!imageUrl) {
@@ -13,7 +13,7 @@ export const getImageAbsoluteURIOrBase64 = (imageUrl?: string | null) => {
return imageUrl;
}
- const serverFilesUrl = REACT_APP_SERVER_FILES_URL;
+ const serverFilesUrl = REACT_APP_SERVER_BASE_URL;
- return `${serverFilesUrl}/${imageUrl}`;
+ return `${serverFilesUrl}/files/${imageUrl}`;
};