From 920126a392635f18a9dd791ed674791c50844d91 Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Mon, 2 Oct 2023 14:09:17 +0200 Subject: [PATCH] Front: Set Env Vars --- front/API.ts | 3 +-- front/eas.json | 4 ++++ front/views/PlayView.tsx | 3 +-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/front/API.ts b/front/API.ts index 802f0d0..d4cb899 100644 --- a/front/API.ts +++ b/front/API.ts @@ -23,7 +23,6 @@ import { AccessTokenResponseHandler } from './models/AccessTokenResponse'; import * as yup from 'yup'; import { base64ToBlob } from './utils/base64ToBlob'; import { ImagePickerAsset } from 'expo-image-picker'; -import Constant from 'expo-constants'; type AuthenticationInput = { username: string; password: string }; type RegistrationInput = AuthenticationInput & { email: string }; @@ -69,7 +68,7 @@ export default class API { public static readonly baseUrl = process.env.NODE_ENV != 'development' && Platform.OS === 'web' ? '/api' - : Constant.manifest?.extra?.apiUrl; + : process.env.EXPO_PUBLIC_API_URL!; public static async fetch( params: FetchParams, handle: Pick, 'raw'> diff --git a/front/eas.json b/front/eas.json index 75a6cf6..c6de4ae 100644 --- a/front/eas.json +++ b/front/eas.json @@ -14,6 +14,10 @@ "gradleCommand": ":app:assembleRelease", "developmentClient": true, "distribution": "internal" + }, + "env": { + "EXPO_PUBLIC_API_URL": "https://chroma.octohub.app/api", + "EXPO_PUBLIC_SCORO_URL": "wss://chroma.octohub.app/ws" } } } diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index a4c2371..45eca36 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -21,7 +21,6 @@ import { RouteProps, useNavigation } from '../Navigation'; import { transformQuery, useQuery } from '../Queries'; import API from '../API'; import LoadingComponent, { LoadingView } from '../components/Loading'; -import Constants from 'expo-constants'; import { useSelector } from 'react-redux'; import { RootState } from '../state/Store'; import { translate } from '../i18n/i18n'; @@ -46,7 +45,7 @@ type ScoreMessage = { }; // this a hot fix this should be reverted soon -let scoroBaseApiUrl = Constants.manifest?.extra?.scoroUrl; +let scoroBaseApiUrl = process.env.EXPO_PUBLIC_SCORO_URL!; if (process.env.NODE_ENV != 'development' && Platform.OS === 'web') { Linking.getInitialURL().then((initUrl) => {