Код: Выделить всё
.env.production
Код: Выделить всё
EXPO_PUBLIC_ENV=production
EXPO_PUBLIC_API_URL="https://my-production-backend.net"
< /code>
.env.local
Код: Выделить всё
EXPO_PUBLIC_ENV=local
EXPO_PUBLIC_API_URL="http://my-local-backend:8000"
< /code>
a config.ts
Код: Выделить всё
import Constants from 'expo-constants';
const config = {
apiUrl: Constants.expoConfig?.extra?.EXPO_PUBLIC_API_URL,
};
export default config;
< /code>
I also have the below in my eas.json
Код: Выделить всё
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"production": {
"autoIncrement": true,
"env": {
"EXPO_PUBLIC_API_URL": "https://my-production-backend.net",
}
}
< /code>
and finally, I have this in app.config.ts
Код: Выделить всё
extra: {
EXPO_PUBLIC_API_URL: process.env.EXPO_PUBLIC_API_URL,
router: {
origin: false,
},
< /code>
I also ran eas env:list
Подробнее здесь: https://stackoverflow.com/questions/796 ... al-backend