From 77080485e4051877dfb0c58eac758dc8f8f97b79 Mon Sep 17 00:00:00 2001 From: Peter Velkov Date: Wed, 15 Sep 2021 18:16:07 +0300 Subject: [PATCH 1/4] tips regarding .env variables Describe some environment variables and specifically the USE_WEB_PROXY as it's causes issues for external contributors --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 48a9fb9828a..46bb541e32d 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ These instructions should get you set up ready to work on New Expensify 🙌 1. Install `node` & `npm`: `brew install node` 2. Install `watchman`: `brew install watchman` 3. Install dependencies: `npm install` +4. Create a `.env` file, use [.env.staging](.env.staging) as a source. + External contributors should set `USE_WEB_PROXY=true` (Otherwise they'll get CORS errors) You can use any IDE or code editing tool for developing on any platform. Use your favorite! @@ -59,6 +61,16 @@ You can use any IDE or code editing tool for developing on any platform. Use you **Note:** Expensify engineers that will be testing with the API in your local dev environment please refer to [these additional instructions](https://stackoverflow.com/c/expensify/questions/7699/7700). +## Environment variables +- `USE_WEB_PROXY` ⚠️used in web/desktop development, it starts a server along the local development server to proxy + requests to the backend. External contributors should set this to `true` otherwise they'll have CORS errors. + If you don't want to start the proxy server set this explicitly to `false` +- `CAPTURE_METRICS` (optional) set this to `true` to capture performance metrics and see them in Flipper + see [PERFORMANCE.md](PERFORMANCE.md#performance-metrics-opt-in-on-local-release-builds) for more information +- `ONYX_METRICS` (optional) set this to `true` to capture even more performance metrics and see them in Flipper + see [React-Native-Onyx#benchmarks](https://github.com/Expensify/react-native-onyx#benchmarks) for more information + + ---- # Running the tests From 5a9648f47b04f8018be511ef986c329b5dea2705 Mon Sep 17 00:00:00 2001 From: Peter Velkov Date: Wed, 15 Sep 2021 19:57:19 +0300 Subject: [PATCH 2/4] docs: troubleshooting regarding CORS issues --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 46bb541e32d..2463d965408 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,6 @@ These instructions should get you set up ready to work on New Expensify 🙌 1. Install `node` & `npm`: `brew install node` 2. Install `watchman`: `brew install watchman` 3. Install dependencies: `npm install` -4. Create a `.env` file, use [.env.staging](.env.staging) as a source. - External contributors should set `USE_WEB_PROXY=true` (Otherwise they'll get CORS errors) You can use any IDE or code editing tool for developing on any platform. Use your favorite! @@ -57,11 +55,18 @@ You can use any IDE or code editing tool for developing on any platform. Use you ## Troubleshooting 1. If you are having issues with **_Getting Started_**, please reference [React Native's Documentation](https://reactnative.dev/docs/environment-setup) -2. If you are running into issues communicating with the API please verify your `.env` file is [set up correctly](#getting-started) for the platform you are trying to run. +2. If you are running into CORS errors like (in the browser dev console) + ```sh + Access to fetch at 'https://www.expensify.com/api?command=GetAccountStatus' from origin 'http://localhost:8080' has been blocked by CORS policy + ``` + You probably have a misconfigured `.env` file - remove it and try again `rm .env` **Note:** Expensify engineers that will be testing with the API in your local dev environment please refer to [these additional instructions](https://stackoverflow.com/c/expensify/questions/7699/7700). ## Environment variables +Creating an `.env` file is not necessary. We advise external contributors against it. It can lead to errors when +variables referenced here get updated since your local `.env` file is ignored. + - `USE_WEB_PROXY` ⚠️used in web/desktop development, it starts a server along the local development server to proxy requests to the backend. External contributors should set this to `true` otherwise they'll have CORS errors. If you don't want to start the proxy server set this explicitly to `false` From 5e59ff44a69dfc8b18e044598c912451990db22f Mon Sep 17 00:00:00 2001 From: Peter Velkov Date: Wed, 29 Sep 2021 15:34:02 +0300 Subject: [PATCH 3/4] Readme: Apply suggestions from code review Co-authored-by: Andrew Gable --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2463d965408..df8fb5f918b 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ You can use any IDE or code editing tool for developing on any platform. Use you ```sh Access to fetch at 'https://www.expensify.com/api?command=GetAccountStatus' from origin 'http://localhost:8080' has been blocked by CORS policy ``` - You probably have a misconfigured `.env` file - remove it and try again `rm .env` + You probably have a misconfigured `.env` file - remove it (`rm .env`) and try again **Note:** Expensify engineers that will be testing with the API in your local dev environment please refer to [these additional instructions](https://stackoverflow.com/c/expensify/questions/7699/7700). @@ -67,6 +67,16 @@ You can use any IDE or code editing tool for developing on any platform. Use you Creating an `.env` file is not necessary. We advise external contributors against it. It can lead to errors when variables referenced here get updated since your local `.env` file is ignored. +- `EXPENSIFY_URL_CASH` - The root URL used for the website +- `EXPENSIFY_URL_SECURE` - The URL used to hit the Expensify secure API +- `EXPENSIFY_URL_COM` - The URL used to hit the Expensify API +- `EXPENSIFY_PARTNER_NAME` - Constant used for the app when authenticating. +- `EXPENSIFY_PARTNER_PASSWORD` - Another constant used for the app when authenticating. (This is OK to be public) +- `PUSHER_APP_KEY` - Key used to authenticate with Pusher.com +- `SECURE_NGROK_URL` - Secure URL used for `ngrok` when testing +- `NGROK_URL` - URL used for `ngrok` when testing +- `USE_NGROK` - Flag to turn `ngrok` testing on or off +- `USE_WDYR` - Flag to turn [`Why Did You Render`](https://github.com/welldone-software/why-did-you-render) testing on or off - `USE_WEB_PROXY` ⚠️used in web/desktop development, it starts a server along the local development server to proxy requests to the backend. External contributors should set this to `true` otherwise they'll have CORS errors. If you don't want to start the proxy server set this explicitly to `false` From 7815def9ac1c702b723e5e334efd3b5985faf44e Mon Sep 17 00:00:00 2001 From: Peter Velkov Date: Wed, 29 Sep 2021 17:45:16 +0300 Subject: [PATCH 4/4] Update README.md add dashes to the rest ENV vars --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index df8fb5f918b..8a0f4725d14 100644 --- a/README.md +++ b/README.md @@ -77,12 +77,12 @@ variables referenced here get updated since your local `.env` file is ignored. - `NGROK_URL` - URL used for `ngrok` when testing - `USE_NGROK` - Flag to turn `ngrok` testing on or off - `USE_WDYR` - Flag to turn [`Why Did You Render`](https://github.com/welldone-software/why-did-you-render) testing on or off -- `USE_WEB_PROXY` ⚠️used in web/desktop development, it starts a server along the local development server to proxy +- `USE_WEB_PROXY`⚠️- Used in web/desktop development, it starts a server along the local development server to proxy requests to the backend. External contributors should set this to `true` otherwise they'll have CORS errors. If you don't want to start the proxy server set this explicitly to `false` -- `CAPTURE_METRICS` (optional) set this to `true` to capture performance metrics and see them in Flipper +- `CAPTURE_METRICS` (optional) - Set this to `true` to capture performance metrics and see them in Flipper see [PERFORMANCE.md](PERFORMANCE.md#performance-metrics-opt-in-on-local-release-builds) for more information -- `ONYX_METRICS` (optional) set this to `true` to capture even more performance metrics and see them in Flipper +- `ONYX_METRICS` (optional) - Set this to `true` to capture even more performance metrics and see them in Flipper see [React-Native-Onyx#benchmarks](https://github.com/Expensify/react-native-onyx#benchmarks) for more information