Skip to content

Environment variable

Sworup Shakya edited this page Nov 14, 2022 · 7 revisions

We use react-native-dotenv to set up the environment variables since mobile version 8.6.2.

How to use

  • Copy the .env.example file and rename it to .env.
  • Set variable values
  • For development, this should be all you need to do.
  • For production build
    • Export the environment variables to have them available during the build
    • Run export REACT_APP_ADMIN_PASSWORD_HASHED=<your hashed password> before you run yarn build
    • Or you can create a production env file .env.production, set the variables there and set the node_env to production before building, like this
      • NODE_ENV=production yarn build

Variables used

Currently, these are the environment variables used:

  1. REACT_APP_ADMIN_PASSWORD_HASHED

    • This is the master admin password for the admin page. After you have synced into a site, you would get an admin setting button in the user login page. Viewing or editing this page requires this admin password.
    • Replace the value mSupply_desktop_admin_password password with the desired password.
    • The password is sha256 encrypted. So if the password was test the value you set here would be 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08. Please use a strong password.
    • Keep in mind that the admin password set here, cannot be replaced for this apk after the build.
    • Refer Bitwarden for the password to use.
Clone this wiki locally