-
-
Notifications
You must be signed in to change notification settings - Fork 931
Description
Hi, I've just started setting up MapBox in my Expo app (following the linked guide here - https://rnmapbox.github.io/docs/install) and I apply the config plugin for it via an app.config.ts file as shown below so that I can store the MAPBOX_SK in a .env file that is not checked into source control. This works great, however, once npx expo prebuild is ran this then spits the SK out into the native Podfile and gradle.properties files which I want to keep checked into source control - the presence of the SK in these files now prevents me from keeping these in source control without leaking the secret key out.
import { ExpoConfig, ConfigContext } from "expo/config";
module.exports = ({ config }: ConfigContext): ExpoConfig => {
return {
name: config.name!,
slug: config.slug!,
...config,
plugins: [
...(config.plugins ?? []),
[
"@rnmapbox/maps",
{
RNMapboxMapsDownloadToken: process.env.MAPBOX_SK,
},
],
],
};
};My question here is what is the correct approach using Expo to keep the secret key safe here? On the iOS and Android tabs in the installation guide it recommends placing the SK into the global gradle properties file or for iOS in a .netrc file (this is also recommended by the official mapbox guides e.g. https://docs.mapbox.com/ios/maps/guides/install/#configure-credentials).
Cheers! 🙌