Add deploy buttons and clean environment variables (#974)
* add render.yaml * Clean environment variables --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -547,7 +547,7 @@ export type ClientConfig = {
|
||||
__typename?: 'ClientConfig';
|
||||
authProviders: AuthProviders;
|
||||
debugMode: Scalars['Boolean'];
|
||||
demoMode: Scalars['Boolean'];
|
||||
signInPrefilled: Scalars['Boolean'];
|
||||
telemetry: Telemetry;
|
||||
};
|
||||
|
||||
@ -2333,7 +2333,7 @@ export type RenewTokenMutation = { __typename?: 'Mutation', renewToken: { __type
|
||||
export type GetClientConfigQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', demoMode: boolean, debugMode: boolean, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean }, telemetry: { __typename?: 'Telemetry', enabled: boolean, anonymizationEnabled: boolean } } };
|
||||
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, debugMode: boolean, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean }, telemetry: { __typename?: 'Telemetry', enabled: boolean, anonymizationEnabled: boolean } } };
|
||||
|
||||
export type GetCompaniesQueryVariables = Exact<{
|
||||
orderBy?: InputMaybe<Array<CompanyOrderByWithRelationInput> | CompanyOrderByWithRelationInput>;
|
||||
@ -3369,7 +3369,7 @@ export const GetClientConfigDocument = gql`
|
||||
google
|
||||
password
|
||||
}
|
||||
demoMode
|
||||
signInPrefilled
|
||||
debugMode
|
||||
telemetry {
|
||||
enabled
|
||||
|
||||
@ -22,7 +22,7 @@ export function useApolloFactory() {
|
||||
|
||||
const apolloClient = useMemo(() => {
|
||||
apolloRef.current = new ApolloFactory({
|
||||
uri: `${process.env.REACT_APP_API_URL}`,
|
||||
uri: `${process.env.REACT_APP_SERVER_BASE_URL}/graphql`,
|
||||
cache: new InMemoryCache({
|
||||
typePolicies: {
|
||||
Activity: {
|
||||
|
||||
@ -118,8 +118,11 @@ export function useAuth() {
|
||||
);
|
||||
|
||||
const handleGoogleLogin = useCallback((workspaceInviteHash?: string) => {
|
||||
const authServerUrl =
|
||||
process.env.REACT_APP_SERVER_AUTH_URL ??
|
||||
process.env.REACT_APP_SERVER_BASE_URL + '/auth';
|
||||
window.location.href =
|
||||
`${process.env.REACT_APP_AUTH_URL}/google/${
|
||||
`${authServerUrl}/google/${
|
||||
workspaceInviteHash ? '?inviteHash=' + workspaceInviteHash : ''
|
||||
}` || '';
|
||||
}, []);
|
||||
|
||||
@ -6,7 +6,7 @@ import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
import { authProvidersState } from '@/client-config/states/authProvidersState';
|
||||
import { isDemoModeState } from '@/client-config/states/isDemoModeState';
|
||||
import { isSignInPrefilledState } from '@/client-config/states/isSignInPrefilledState';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
|
||||
import { useSnackBar } from '@/ui/snack-bar/hooks/useSnackBar';
|
||||
@ -45,7 +45,7 @@ export function useSignInUp() {
|
||||
const { enqueueSnackBar } = useSnackBar();
|
||||
const isMatchingLocation = useIsMatchingLocation();
|
||||
const [authProviders] = useRecoilState(authProvidersState);
|
||||
const isDemoMode = useRecoilValue(isDemoModeState);
|
||||
const isSignInPrefilled = useRecoilValue(isSignInPrefilledState);
|
||||
const workspaceInviteHash = useParams().workspaceInviteHash;
|
||||
const [signInUpStep, setSignInUpStep] = useState<SignInUpStep>(
|
||||
SignInUpStep.Init,
|
||||
@ -61,8 +61,8 @@ export function useSignInUp() {
|
||||
mode: 'onChange',
|
||||
defaultValues: {
|
||||
exist: false,
|
||||
email: isDemoMode ? 'tim@apple.dev' : '',
|
||||
password: isDemoMode ? 'Applecar2025' : '',
|
||||
email: isSignInPrefilled ? 'tim@apple.dev' : '',
|
||||
password: isSignInPrefilled ? 'Applecar2025' : '',
|
||||
},
|
||||
resolver: yupResolver(validationSchema),
|
||||
});
|
||||
|
||||
@ -3,7 +3,7 @@ import { useRecoilState } from 'recoil';
|
||||
|
||||
import { authProvidersState } from '@/client-config/states/authProvidersState';
|
||||
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
|
||||
import { isDemoModeState } from '@/client-config/states/isDemoModeState';
|
||||
import { isSignInPrefilledState } from '@/client-config/states/isSignInPrefilledState';
|
||||
import { telemetryState } from '@/client-config/states/telemetryState';
|
||||
import { useGetClientConfigQuery } from '~/generated/graphql';
|
||||
|
||||
@ -12,7 +12,7 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
||||
}) => {
|
||||
const [, setAuthProviders] = useRecoilState(authProvidersState);
|
||||
const [, setDebugMode] = useRecoilState(isDebugModeState);
|
||||
const [, setDemoMode] = useRecoilState(isDemoModeState);
|
||||
const [, setSignInPrefilled] = useRecoilState(isSignInPrefilledState);
|
||||
const [, setTelemetry] = useRecoilState(telemetryState);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
@ -29,14 +29,14 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
||||
magicLink: false,
|
||||
});
|
||||
setDebugMode(data?.clientConfig.debugMode);
|
||||
setDemoMode(data?.clientConfig.demoMode);
|
||||
setSignInPrefilled(data?.clientConfig.signInPrefilled);
|
||||
setTelemetry(data?.clientConfig.telemetry);
|
||||
}
|
||||
}, [
|
||||
data,
|
||||
setAuthProviders,
|
||||
setDebugMode,
|
||||
setDemoMode,
|
||||
setSignInPrefilled,
|
||||
setTelemetry,
|
||||
setIsLoading,
|
||||
loading,
|
||||
|
||||
@ -7,7 +7,7 @@ export const GET_CLIENT_CONFIG = gql`
|
||||
google
|
||||
password
|
||||
}
|
||||
demoMode
|
||||
signInPrefilled
|
||||
debugMode
|
||||
telemetry {
|
||||
enabled
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
export const isDemoModeState = atom<boolean>({
|
||||
key: 'isDemoModeState',
|
||||
default: false,
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
export const isSignInPrefilledState = atom<boolean>({
|
||||
key: 'isSignInPrefilledState',
|
||||
default: false,
|
||||
});
|
||||
@ -11,5 +11,9 @@ export function getImageAbsoluteURIOrBase64(imageUrl?: string | null) {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
return `${process.env.REACT_APP_FILES_URL}/${imageUrl}`;
|
||||
const serverFilesUrl =
|
||||
process.env.REACT_APP_SERVER_FILES_URL ??
|
||||
process.env.REACT_APP_SERVER_BASE_URL + '/files';
|
||||
|
||||
return `${serverFilesUrl}/${imageUrl}`;
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ export const graphqlMocks = [
|
||||
return res(
|
||||
ctx.data({
|
||||
clientConfig: {
|
||||
demoMode: true,
|
||||
signInPrefilled: true,
|
||||
debugMode: false,
|
||||
authProviders: { google: true, password: true, magicLink: false },
|
||||
telemetry: { enabled: false, anonymizationEnabled: true },
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
||||
|
||||
export const mockedClient = new ApolloClient({
|
||||
uri: process.env.REACT_APP_API_URL,
|
||||
uri: process.env.REACT_APP_SERVER_BASE_URL + '/graphql',
|
||||
cache: new InMemoryCache(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user