I've a very basic question. While going through blogs about Visual Studio AppCenter for React Native apps, I saw that custom build environment variables inside AppCenter are expected to begin with 'RN_' prefix. I want to know if the environment variable are required to begin with a 'RN_' prefix in AppCenter? What about inside my React Native app, should they also be defined with a 'RN_' prefix?
e.g. I currently have environment variables for my API key and URL in my React Native app as follows:
- '
MY_API_URL
' ==> environment variable for my app's API URL - '
MY_API_KEY
' ==> environment variable for my app's API key.
Does this mean that for AppCenter I should rename them in my app too as:
- RN_MY_API_URL
- RN_MY_API_KEY
or, in my reach native app they will remain as 'MY_API_URL' and 'MY_API_KEY'
, whereas in AppCenter they will be defined as 'RN_MY_API_URL' and 'RN_MY_API_KEY'
?
My appcenter-pre-build.sh
file looks like this:
ENV_WHITELIST=${ENV_WHITELIST:-"^RN_"}
printf "Creating an .env file with the following whitelist:\n"
printf "%s\n" $ENV_WHITELIST
set | egrep -e $ENV_WHITELIST | sed 's/^RN_//g' > .env
printf "\n.env created with contents:\n\n"
cat .env
I assume they should be prefixed as 'RN_'
inside AppCenter and without 'RN_'
inside my app, can someone please confirm this?