I want to pass a secret variable in the extra object (in app.config.js with process.env) so I can use it in my project ( google api key in this case )
But when I display the extra object (through Constants.expoConfig.extra.googleApiKey), the googleApiKey key is missing
Here’s my eas.json
{
"build": {
"staging": {
"distribution": "internal",
"channel": "staging",
"env": {
"APP_ENV": "staging"
}
},
"production": {
"channel": "production",
"env": {
"APP_ENV": "production"
}
}
},
"cli": {
"promptToConfigurePushNotifications": false
}
}
Here’s my app.config.js :
let config = {};
switch (process.env.APP_ENV) {
case "production":
appName = "APPNAME";
bundleIdentifier = "com.appname.app";
config.env = process.env.APP_ENV;
config.googleApiKey = process.env.GOOGLE_API_KEY_PROD;
break;
case "staging":
appName = "APPNAME (STAGING)";
bundleIdentifier = "com.appname.staging";
config.env = process.env.APP_ENV;
config.googleApiKey = process.env.GOOGLE_API_KEY_STAGING;
break;
}
export default () => ({
name: appName,
version: "1.0.0",
.
.
.
sdkVersion: "46.0.0",
extra: {
eas: {
projectId: ...
},
...config,
},
});
Workflow : Managed
Build command : APP_ENV=staging eas build --profile staging
PS : when I type eas secret:list, I can see all of my secrets
They appears in the logs on my expo.dev console too when I start a build