I am struggling with getting .env
variables to show up in my React Native app, when compiling with VS App Center. I am using react-native-config
, and have a local .env
file that work when developing locally, but when I build with VS App Center, the predefined environment variables in the console, are available via the app.
I have added the following variables in the console:
Then, I have created a appcenter-post-clone.sh
in the root directory of the project:
#!/usr/bin/env bash
echo "Creating .env file"
cat > ./.env <<EOL
API_URL=${API_URL}
GOOGLE_API_KEY=${GOOGLE_API_KEY}
EOL
However, no .env is created - there is nothing in the build log with Creating .env file
, so I am confused on what the best path is here. Does anyone have any guidance here on how to read .env
values with App Center builds?