Skip to content

Commit

Permalink
Setup env variable, ignored in git
Browse files Browse the repository at this point in the history
  • Loading branch information
sah-arjun committed Oct 19, 2022
1 parent a2a4420 commit 4900270
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# OSX
#
.DS_Store
.env

# Xcode
#
Expand Down
10 changes: 10 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module:react-native-dotenv',
{
envName: 'APP_ENV',
moduleName: '@env',
path: '.env',
},
],
],
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"lint-staged": "^10.5.4",
"metro-react-native-babel-preset": "^0.66.0",
"prettier": "^2.2.1",
"react-native-dotenv": "^3.3.1",
"react-native-typescript-transformer": "^1.2.13",
"typescript": "^4.3.5"
}
Expand Down
7 changes: 6 additions & 1 deletion src/pages/SettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import { Dimensions, Text, View, ToastAndroid, TouchableOpacity } from 'react-na
import RNRestart from 'react-native-restart';
import { Button } from 'react-native-ui-components';

// eslint-disable-next-line import/no-unresolved
import { REACT_APP_ADMIN_PASSWORD_HASHED } from '@env';

import { importData, UIDatabase } from '../database';
import { SETTINGS_KEYS } from '../settings';
import AppSettings from '../settings/MobileAppSettings';
import { MODAL_KEYS } from '../utilities';

import {
gotoEditSensorPage,
gotoFridgeDetailPage,
Expand Down Expand Up @@ -118,6 +120,9 @@ const Settings = ({

const save = enteredPassword => {
const passwordMatch = hashPassword(enteredPassword) === currentUserPasswordHash;
console.log('hashPassword(enteredPassword) ', hashPassword(enteredPassword));
console.log('REACT_APP_ADMIN_PASSWORD_HASHED ', REACT_APP_ADMIN_PASSWORD_HASHED);

const toastMessage = passwordMatch
? generalStrings.new_details_saved
: generalStrings.new_details_not_saved;
Expand Down

0 comments on commit 4900270

Please sign in to comment.