Delete auth/file front variables (#4455)

This commit is contained in:
Félix Malfait 2024-03-19 22:19:40 +01:00 committed by GitHub
parent 4bfb90657f
commit b6e8bb1a6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 10 additions and 36 deletions

View File

@ -1,8 +1,6 @@
FROM node:18.17.1-alpine as twenty-front-build FROM node:18.17.1-alpine as twenty-front-build
ARG REACT_APP_SERVER_BASE_URL ARG REACT_APP_SERVER_BASE_URL
ARG REACT_APP_SERVER_AUTH_URL
ARG REACT_APP_SERVER_FILES_URL
WORKDIR /app WORKDIR /app

View File

@ -229,14 +229,6 @@ resource "azurerm_container_app" "twenty_front" {
name = "REACT_APP_SERVER_BASE_URL" name = "REACT_APP_SERVER_BASE_URL"
value = "https://${azurerm_container_app.twenty_server.ingress[0].fqdn}" 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"
}
} }
} }
} }

View File

@ -59,8 +59,6 @@ services:
environment: environment:
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED} - SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
- REACT_APP_SERVER_BASE_URL=${LOCAL_SERVER_URL} - 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: depends_on:
- backend - backend

View File

@ -23,8 +23,6 @@ import TabItem from '@theme/TabItem';
<OptionTable options={[ <OptionTable options={[
['REACT_APP_SERVER_BASE_URL', 'http://localhost:3000', 'Url of backend server'], ['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'], ['GENERATE_SOURCEMAP', 'false', 'Generate source maps for debugging'],
['CHROMATIC_PROJECT_TOKEN', '', 'Chromatic token used for CI'], ['CHROMATIC_PROJECT_TOKEN', '', 'Chromatic token used for CI'],
]}></OptionTable> ]}></OptionTable>

View File

@ -2,6 +2,4 @@ REACT_APP_SERVER_BASE_URL=http://localhost:3000
GENERATE_SOURCEMAP=false GENERATE_SOURCEMAP=false
# ———————— Optional ———————— # ———————— Optional ————————
# REACT_APP_SERVER_AUTH_URL=http://localhost:3000/auth
# REACT_APP_SERVER_FILES_URL=http://localhost:3000/files
# CHROMATIC_PROJECT_TOKEN= # CHROMATIC_PROJECT_TOKEN=

View File

@ -28,13 +28,3 @@ export const REACT_APP_SERVER_BASE_URL =
window._env_?.REACT_APP_SERVER_BASE_URL || window._env_?.REACT_APP_SERVER_BASE_URL ||
process.env.REACT_APP_SERVER_BASE_URL || process.env.REACT_APP_SERVER_BASE_URL ||
getDefaultUrl(); 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';

View File

@ -19,7 +19,7 @@ import { supportChatState } from '@/client-config/states/supportChatState';
import { telemetryState } from '@/client-config/states/telemetryState'; import { telemetryState } from '@/client-config/states/telemetryState';
import { iconsState } from '@/ui/display/icon/states/iconsState'; import { iconsState } from '@/ui/display/icon/states/iconsState';
import { ColorScheme } from '@/workspace-member/types/WorkspaceMember'; import { ColorScheme } from '@/workspace-member/types/WorkspaceMember';
import { REACT_APP_SERVER_AUTH_URL } from '~/config'; import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { import {
useChallengeMutation, useChallengeMutation,
useCheckUserExistsLazyQuery, useCheckUserExistsLazyQuery,
@ -204,9 +204,9 @@ export const useAuth = () => {
); );
const handleGoogleLogin = useCallback((workspaceInviteHash?: string) => { const handleGoogleLogin = useCallback((workspaceInviteHash?: string) => {
const authServerUrl = REACT_APP_SERVER_AUTH_URL; const authServerUrl = REACT_APP_SERVER_BASE_URL;
window.location.href = window.location.href =
`${authServerUrl}/google/${ `${authServerUrl}/auth/google/${
workspaceInviteHash ? '?inviteHash=' + workspaceInviteHash : '' workspaceInviteHash ? '?inviteHash=' + workspaceInviteHash : ''
}` || ''; }` || '';
}, []); }, []);

View File

@ -6,7 +6,7 @@ import { Button } from '@/ui/input/button/components/Button';
import { Card } from '@/ui/layout/card/components/Card'; import { Card } from '@/ui/layout/card/components/Card';
import { CardContent } from '@/ui/layout/card/components/CardContent'; import { CardContent } from '@/ui/layout/card/components/CardContent';
import { CardHeader } from '@/ui/layout/card/components/CardHeader'; 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'; import { useGenerateTransientTokenMutation } from '~/generated/graphql';
const StyledHeader = styled(CardHeader)` const StyledHeader = styled(CardHeader)`
@ -30,14 +30,14 @@ export const SettingsAccountsListEmptyStateCard = ({
const [generateTransientToken] = useGenerateTransientTokenMutation(); const [generateTransientToken] = useGenerateTransientTokenMutation();
const handleGmailLogin = useCallback(async () => { const handleGmailLogin = useCallback(async () => {
const authServerUrl = REACT_APP_SERVER_AUTH_URL; const authServerUrl = REACT_APP_SERVER_BASE_URL;
const transientToken = await generateTransientToken(); const transientToken = await generateTransientToken();
const token = const token =
transientToken.data?.generateTransientToken.transientToken.token; transientToken.data?.generateTransientToken.transientToken.token;
window.location.href = `${authServerUrl}/google-gmail?transientToken=${token}`; window.location.href = `${authServerUrl}/auth/google-gmail?transientToken=${token}`;
}, [generateTransientToken]); }, [generateTransientToken]);
return ( return (

View File

@ -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) => { export const getImageAbsoluteURIOrBase64 = (imageUrl?: string | null) => {
if (!imageUrl) { if (!imageUrl) {
@ -13,7 +13,7 @@ export const getImageAbsoluteURIOrBase64 = (imageUrl?: string | null) => {
return imageUrl; return imageUrl;
} }
const serverFilesUrl = REACT_APP_SERVER_FILES_URL; const serverFilesUrl = REACT_APP_SERVER_BASE_URL;
return `${serverFilesUrl}/${imageUrl}`; return `${serverFilesUrl}/files/${imageUrl}`;
}; };