Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Not clear on how to use environment variables #372

Open
nonameolsson opened this issue Aug 18, 2020 · 2 comments
Open

Not clear on how to use environment variables #372

nonameolsson opened this issue Aug 18, 2020 · 2 comments

Comments

@nonameolsson
Copy link
Contributor

nonameolsson commented Aug 18, 2020


What's going on?

In the Ignite Bowser Expo template, there is an .env file. I can’t see that it is used in the boilerplate. It also says in the comment:

# This is an example where you can store your environment variables.
# It uses react-native-dotenv as a babel transform.
#
# Then just do this to import them:
# import { API_URL } from ‘react-native-dotenv’

The instructions on how to use environment variables doesn't seem to be up-to-date because react-native-dotenv isn't included in package.json.

Is this just some old code still laying around, or should the comment include some instructions that a user should add that package? Or should that package be included in the boilerplate?

Since the boilerplate now supports Expo, maybe expo-constants should be the preferred way of using environment variables. https://docs.expo.io/guides/environment-variables/

At the same time, the folder app/config/ contains files that allows a user to use those as some kind of environment variables.


Steps to reproduce

  1. Generate a new app
  2. Follow the instructions in .env
  3. Error

ignite doctor results:

System
  platform           darwin                                                 
  arch               x64                                                    
  cpu                8 cores      Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz 
  directory          bowser       /Users/andreasolsson/Code/bowser          

JavaScript
  node               12.18.2      /Users/andreasolsson/.asdf/installs/nodejs/12.18.2/bin/node 
  npm                6.14.5       /Users/andreasolsson/.asdf/installs/nodejs/12.18.2/bin/npm  
  yarn               1.22.4       /Users/andreasolsson/.yarn/bin/yarn                         

Ignite
  ignite-cli           3.5.2              /Users/andreasolsson/.asdf/installs/nodejs/12.18.2/.npm/bin/ignite     
  ignite src           build              /Users/andreasolsson/.config/yarn/global/node_modules/ignite-cli/build 
  navigation           react-navigation                                                                          
  generators                                                                                                     
                       component          ignite-bowser                                                          
                       model              ignite-bowser                                                          
                       navigator          ignite-bowser                                                          
                       screen             ignite-bowser                                                          
  createdWith          3.5.2                                                                                     
  boilerplate          ignite-bowser                                                                             
  boilerplateVersion   5.3.0                                                                                     

Android
  java               14.0.2       /usr/bin/java 
  android home       -            undefined     

iOS
  xcode              11.6       
  cocoapods          1.9.3        /usr/local/bin/pod 
@nonameolsson
Copy link
Contributor Author

nonameolsson commented Aug 18, 2020

Maybe this is related #194 #274 ?

@tyler-jewell
Copy link

Any update? I am using Ignite Flame and wondering the same thing. Instead of accessing the dev menu to toggle storybook UI (which doesn't appear to be working), I'd rather just pass a variable to expo start --storybook=true to run the story ok.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants