Skip to main content

Doppler configuration 🌈

Why you need it?​

Thanks to doppler you will be able to autoamtically mange your environment varialbes.

This starter have fully integrated doppler configuration, you just need to do few easy steps

Configuration​

1. Sign up for the Doppler tool

a. Ideally, the account will be created by the client, the developer will be invited to participate in a workspace

2. Create a new workspace for the project.

a. Open a dropdown of the workspaces list:

Open dropdown

b. Click +Create workspace button: Create workspace

c. Fill in the workspace name: Fill workspace name

d. Confirm Create Workspace β†’ button Confirm workspace creation

3. Create new project

a. In newly created workspace please click Create Project button

Create project

b. Provide project name Project name

c. Confirm with Create Project β†’ button Confirm project creation

4. Adding environment variables.

a. Enter the projects tab, and select a newly created project

Select project

b. Each project consist of three predefined environments - dev, stg and prd. ** Click each of them to enter environment variable page. Select environment

c. To add a new environment variable click on Add first secret Add first secret

d. Enter the name of the environment variable name and its value into proper inputs: ** Secret list

You can add more environment variables by clicking + Add Secret button, and providing names and values. Add more secrets

e. Confirm with Save button: Save secrets

g. Make sure that you have consistent data in each environment. In these step, you can copy newly created variable to the rest environments (select checkboxes). When selected the necessary environments confirm with Save button: Confirm save secrets

5. Get Access tokens

a. Enter Access tab:

Access tab

b. In the Access tab you should click on +Generate or Generate Service Token button: Generate token

c. Provide some unique name to your personal access token: Token name

d. And next click Generate Service Token→ button: Confirm generate token

e. Copy your Access Token (Service Token).

Save your Access Token, it will be used later to grant access from the code level. If you do not copy the token, you will need to revoke that token and generate a new one.

Click copy button: Copy token

f. To be able to use environment variables for different environments (qa/staging/production) you need to generate an access token for every environment.

6. Place dopler tokens in configuration file
  1. Create empty file scripts/doppler_variables.sh and add this script to new created file.
  • run this command (this will copy template and place it in scripts/doppler_variables.sh)
yarn prepare:env_file
  1. Add correct values to variables (ask one of the developers for that), example:
export DOPPLER_TOKEN_DEVELOPMENT=dp.st.alpha.XXXXxxxxXXXXxxxxXXXXxxxx
7. Check if everything works correctly.

In project dir terminal run:

yarn generate:env:(qa/staging/production)

Choose the proper app version depending on the environment for which you want to generate env file.

.env file should be generated and consist of variables passed to Doppler, and some extra doppler variables as DOPPLER_CONFIG.

CONGRATULATION !! πŸ₯³πŸ₯³ You have configured the Doppler tool for your project!


Additionaly you can start the expo server:

  • this will start server and generate env variables
  yarn start