I have dynamic configuration for my EAS environment:
eas.json
{
"cli": {
"version": ">= 0.55.1",
"appVersionSource": "local"
},
"build": {
"development": {
"distribution": "internal",
"ios": {
"simulator": true
},
"env": {
"API_URL": "http://localhost/",
"APP_ENV": "development",
}
},
"staging": {
"distribution": "internal",
"env": {
"API_URL": "https://dev.my-url.com/",
"APP_ENV": "staging",
}
},
"production": {
"env": {
"API_URL": "https://my-url.com/",
"APP_ENV": "production",
}
}
},
"submit": {
"production": {
"android": {
"serviceAccountKeyPath": "./keys/pc-api-ccc.json",
"track": "internal"
}
},
"staging": {
"extends": "production"
}
}
}
and accordingly have app.config.js
import "dotenv/config";
export default () => {
console.log("ENV", process.env.API_URL);
return {
//...
extra: {
API_URL: process.env.API_URL,
APP_ENV: process.env.APP_ENV,
DEEP_LINK: process.env.DEEP_LINK,
eas: {
projectId: "2c680410-428f-431d-911f-fb378e45b885",
},
//...
};
For some reason, after running eas build -p ios --profile staging
config default function is called 3 times and in last call environment variables are lost:
console.log output:
ENV https://my-url.com/
ENV https://my-url.com/
ENV undefined
Any idea why 3 times? or why I'm loosing env variables on last call?