Merge pull request 'Use environment variables for uri' (#5) from env-files into master

Reviewed-on: billnerds/rn-playground#5
This commit is contained in:
Kat Huang 2024-01-06 15:19:38 -07:00
commit 66d045c2a7
5 changed files with 30 additions and 2 deletions

2
.env.development Normal file
View File

@ -0,0 +1,2 @@
# .env.development
API_URI=https://api-dev.example.com/graphql

2
.env.production Normal file
View File

@ -0,0 +1,2 @@
# .env.production
API_URI=https://api.example.com/graphql

View File

@ -2,5 +2,14 @@ module.exports = function(api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
["module:react-native-dotenv", {
"moduleName": "@env",
"path": ".env",
"safe": false,
"allowUndefined": true,
"verbose": false,
}],
],
};
};

View File

@ -1,5 +1,5 @@
{
"name": "dummyapp",
"name": "railbird-rn",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
@ -8,7 +8,9 @@
"ios": "expo start --ios",
"web": "expo start --web",
"lint": "eslint . --ext .js,.ts,.tsx",
"lint:fix": "eslint . --ext .ts,.tsx --fix"
"lint:fix": "eslint . --ext .ts,.tsx --fix",
"start:dev": "ENVFILE=.env.development react-native start",
"start:prod": "ENVFILE=.env.production react-native start"
},
"dependencies": {
"@types/react": "~18.2.14",
@ -22,6 +24,7 @@
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-native": "0.72.6",
"react-native-dotenv": "^3.4.9",
"typescript": "^5.3.3"
},
"devDependencies": {

View File

@ -3270,6 +3270,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"
@ -6288,6 +6293,13 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
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@0.72.6:
version "0.72.6"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.72.6.tgz#9f8d090694907e2f83af22e115cc0e4a3d5fa626"