Front: Set Env Vars

This commit is contained in:
Arthur Jamet
2023-10-02 14:09:17 +02:00
parent 16e6a5e21b
commit 920126a392
3 changed files with 6 additions and 4 deletions

View File

@@ -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<Required<HandleParams>, 'raw'>

View File

@@ -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"
}
}
}

View File

@@ -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) => {