diff --git a/.env.example b/.env.example index 72b8339..413dbc9 100644 --- a/.env.example +++ b/.env.example @@ -8,8 +8,8 @@ POSTGRES_DB=chromacase API_URL=http://localhost:80/api SCORO_URL=ws://localhost:6543 MINIO_ROOT_PASSWORD=12345678 -EXPO_PUBLIC_API_URL=$API_URL -EXPO_PUBLIC_SCORO_URL=$SCORO_URL +EXPO_PUBLIC_API_URL=http://localhost:80/api +EXPO_PUBLIC_SCORO_URL=ws://localhost:6543 GOOGLE_CLIENT_ID=toto GOOGLE_SECRET=tata GOOGLE_CALLBACK_URL=http://localhost:19006/logged/google diff --git a/front/API.ts b/front/API.ts index d4cb899..1b44bce 100644 --- a/front/API.ts +++ b/front/API.ts @@ -23,6 +23,7 @@ import { AccessTokenResponseHandler } from './models/AccessTokenResponse'; import * as yup from 'yup'; import { base64ToBlob } from './utils/base64ToBlob'; import { ImagePickerAsset } from 'expo-image-picker'; +import Constants from 'expo-constants'; type AuthenticationInput = { username: string; password: string }; type RegistrationInput = AuthenticationInput & { email: string }; diff --git a/front/babel.config.js b/front/babel.config.js index 34f7fe4..68dbd39 100644 --- a/front/babel.config.js +++ b/front/babel.config.js @@ -2,6 +2,19 @@ module.exports = function (api) { api.cache(true); return { presets: ['babel-preset-expo'], + plugins: [ + [ + 'module:react-native-dotenv', + { + moduleName: '@env', + path: '.env', + blacklist: null, + whitelist: null, + safe: false, + allowUndefined: true, + }, + ], + ], // plugins: ['@babel/plugin-proposal-export-namespace-from', 'react-native-reanimated/plugin'], // env: { // production: { diff --git a/front/eas.json b/front/eas.json index c6de4ae..4cb7427 100644 --- a/front/eas.json +++ b/front/eas.json @@ -6,6 +6,10 @@ "gradleCommand": ":app:assembleDebug", "developmentClient": true, "distribution": "internal" + }, + "env": { + "EXPO_PUBLIC_API_URL": "https://chroma.octohub.app/api", + "EXPO_PUBLIC_SCORO_URL": "wss://chroma.octohub.app/ws" } }, "production": { diff --git a/front/package.json b/front/package.json index 94e0cc3..54c637c 100644 --- a/front/package.json +++ b/front/package.json @@ -43,6 +43,7 @@ "react-i18next": "^13.2.2", "react-native": "0.72.5", "react-native-chart-kit": "^6.12.0", + "react-native-dotenv": "^3.4.9", "react-native-pager-view": "6.2.0", "react-native-reanimated": "~3.3.0", "react-native-safe-area-context": "4.6.3", diff --git a/front/yarn.lock b/front/yarn.lock index e678e5d..119dbec 100644 --- a/front/yarn.lock +++ b/front/yarn.lock @@ -5564,6 +5564,11 @@ dotenv-expand@~10.0.0: resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-10.0.0.tgz#12605d00fb0af6d0a592e6558585784032e4ef37" integrity sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A== +dotenv@^16.3.1: + version "16.3.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" + integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== + dotenv@~16.0.3: version "16.0.3" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07" @@ -10530,6 +10535,13 @@ react-native-chart-kit@^6.12.0: paths-js "^0.4.10" point-in-polygon "^1.0.1" +react-native-dotenv@^3.4.9: + version "3.4.9" + resolved "https://registry.yarnpkg.com/react-native-dotenv/-/react-native-dotenv-3.4.9.tgz#621c5b0c1d0c5c7f569bfe5a1d804bec7885c010" + integrity sha512-dbyd+mcy7SUzxEgmt33TRf1FGcNe6swJhXmB0unKkI49F7+pidog9kPtjxMLTAfmKA8gcN2XHQSKltGfGbGCLQ== + dependencies: + dotenv "^16.3.1" + react-native-pager-view@6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/react-native-pager-view/-/react-native-pager-view-6.2.0.tgz#51380d93fbe47f6380dc71d613a787bf27a4ca37"