Skip to content

Commit

Permalink
update .env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
thienlnam committed Nov 17, 2020
1 parent 03a2e02 commit 5ed1424
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Rename this file to `.env` and put your local config in here
*/
EXPENSIFY_API_ROOT=https://www.expensify.com.dev/api?
EXPENSIFY_SITE_ROOT=https://expensify.com.dev/
EXPENSIFY_PARTNER_NAME=android
EXPENSIFY_PARTNER_PASSWORD=c3a9ac418ea3f152aae2
PUSHER_APP_KEY=ac6d22b891daae55283a
PUSHER_APP_KEY=ac6d22b891daae55283a
4 changes: 2 additions & 2 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXPENSIFY_SITE_ROOT=https://chat.expensify.com/
EXPENSIFY_API_ROOT=https://www.expensify.com/api?
EXPENSIFY_CASH_SITE_ROOT=https://chat.expensify.com/
EXPENSIFY_SITE_ROOT=https://expensify.com/
EXPENSIFY_PARTNER_NAME=chat-expensify-com
EXPENSIFY_PARTNER_PASSWORD=e21965746fd75f82bb66
PUSHER_APP_KEY=268df511a204fbb60884
6 changes: 5 additions & 1 deletion src/CONFIG.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import Config from 'react-native-config';
export default {
AUTH_TOKEN_EXPIRATION_TIME: 1000 * 60 * 90,
EXPENSIFY: {
API_ROOT: Config.EXPENSIFY_API_ROOT,
API_ROOT: Config.NGROK_URL
? `${Config.NGROK_URL}/api?`
: `${Config.EXPENSIFY_SITE_ROOT}api?`,
NGROK_URL: Config.NGROK_URL,
CASH_SITE_ROOT: Config.EXPENSIFY_CASH_ROOT,
SITE_ROOT: Config.EXPENSIFY_SITE_ROOT,
PARTNER_NAME: Config.EXPENSIFY_PARTNER_NAME,
PARTNER_PASSWORD: Config.EXPENSIFY_PARTNER_PASSWORD,
Expand Down
2 changes: 0 additions & 2 deletions src/CONST.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const CLOUDFRONT_URL = 'https://d2k5nsl2zxldvw.cloudfront.net';
const MOZILLA_PDF_VIEWER_URL = 'http://mozilla.github.com/pdf.js/web/viewer.html';
const EXPENSIFY_DEV_URL = 'https://www.expensify.com.dev';

const CONST = {
CLOUDFRONT_URL,
MOZILLA_PDF_VIEWER_URL,
EXPENSIFY_DEV_URL,
EXPENSIFY_ICON_URL: `${CLOUDFRONT_URL}/images/favicon-2019.png`,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/AttachmentView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import Str from 'js-libs/lib/str';
import Str from 'expensify-common/lib/str';
import styles from '../styles/StyleSheet';
import PDFView from './PDFView';
import ImageView from './ImageView';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/HttpUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function xhr(command, data, type = 'post') {
* @returns {Promise<Response>}
*/
function download(relativePath) {
const siteRoot = CONFIG.EXPENSIFY.SITE_ROOT;
const siteRoot = CONFIG.EXPENSIFY.CASH_SITE_ROOT;

// Strip leading slashes and periods from relative path, if present
const strippedRelativePath = relativePath.charAt(0) === '/' || relativePath.charAt(0) === '.'
Expand Down
7 changes: 3 additions & 4 deletions src/pages/home/report/ReportActionItemFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import ImageThumbnailWithModal from '../../../components/ImageThumbnailWithModal
import InlineCodeBlock from '../../../components/InlineCodeBlock';
import {getAuthToken} from '../../../libs/API';
import Config from '../../../CONFIG';
import CONST from '../../../CONST';

const propTypes = {
// The message fragment needing to be displayed
Expand Down Expand Up @@ -80,9 +79,9 @@ class ReportActionItemFragment extends React.PureComponent {

// Update the image URL so the images can be accessed in a dev envrionment
if (!Config.IS_IN_PRODUCTION) {
const devAPIURL = Config.EXPENSIFY.API_ROOT.replace('/api?', '');
previewSource = previewSource.replace(CONST.EXPENSIFY_DEV_URL, devAPIURL);
source = source.replace(CONST.EXPENSIFY_DEV_URL, devAPIURL);
const devURL = Config.EXPENSIFY.NGROK_URL || Config.EXPENSIFY.SITE_ROOT;
previewSource = previewSource.replace(Config.EXPENSIFY.SITE_ROOT, devURL);
source = source.replace(Config.EXPENSIFY.SITE_ROOT, devURL);
}

return (
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/mocks/react-native-config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export default {
REPORT_IDS: '1,2',
EXPENSIFY_API_ROOT: 'https://www.expensify.com.dev/api?',
EXPENSIFY_SITE_ROOT: 'https://expensify.com.dev/',
EXPENSIFY_PARTNER_NAME: 'android',
EXPENSIFY_PARTNER_PASSWORD: 'c3a9ac418ea3f152aae2',
PUSHER_APP_KEY: 'ac6d22b891daae55283a',
PUSHER_AUTH_URL: 'https://www.expensify.com.dev',
NGROK_URL: '',
PARTNER_USER_ID: '',
PARTNER_USER_SECRET: ''
};

0 comments on commit 5ed1424

Please sign in to comment.