-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweaks to Authentication Recipe #162
base: main
Are you sure you want to change the base?
Conversation
"preview:device": { | ||
"env": { | ||
"EXPO_PUBLIC_SUPABASE_URL": "https://<your-project-id>.supabase.co", | ||
"EXPO_PUBLIC_SUPABASE_ANON_KEY": "<your-anon-public-key>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mazenchami I agree. I'm not really a fan of this as I would much rather this be a secret loaded from EAS Secrets. I realize that this key can be public and even looking through the documentation across Supabase and Expo they just mostly inline it right into the code:
- https://docs.expo.dev/guides/using-supabase/
- https://supabase.com/docs/guides/getting-started/tutorials/with-expo-react-native#initialize-a-react-native-app
The dynamic config you were talking about referenced here: https://docs.expo.dev/eas-update/environment-variables/#using-variables-in-appconfigjs This appears to be the pre-SDK-49 way of doing things?
Even still we'd be committing those environment variables to the repo because they'd have to exist in eas.json
for the particular profile: https://docs.expo.dev/build-reference/variables/#for-use-by-your-expo-config
Honestly, the easiest method is just to push the env into secrets right from the CLI:
https://docs.expo.dev/build-reference/variables/#adding-secrets-with-eas-cli
eas secret:push --scope project --env-file .env
The only issue with this is that they'd be the same across any of the EAS profiles because EAS secrets does not care about which environment they are loaded in.
It feels like there's a missing piece here. What am I missing?
@frankcalise thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two thoughts:
- You don't have to solve that problem of environments here, as that could be explained in detail elsewhere (for example, this recipe which is an older Ignite 8 one that should be more inline with Expo builds
- But on how to actually execute different vars per environment, you would likely define some env in
eas.json
for example, likeAPP_VARIANT
orAPP_ENV
in each one. Then in the dynamic config,app.config.ts
, switch off that to call on the proper secrets. You'd have to store unique secrets per environment in this case, so prefixing them in some consistent way I guess would work.
It would be cool though, if there was a dropdown in the dashboard (and eas secret command) to specify that it belongs to a specific build profile. Maybe there is a reason they don't have that but I'll bring it up at Appjs next week
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Frank's thoughts here, mainly: "You don't have to solve that problem of environments here..."
Summary
Thanks to @mazenchami for reporting these!