admin管理员组文章数量:1122846
I am using Expo's EAS Build and have learned there are three ways to define environment variables:
eas.json
: Adding the variables directly in the env property of each build profile.- EAS Secrets: Storing sensitive variables securely using the
eas secret:create
command. - Command-line flag: Passing variables with the
--env
flag during the build command.
I want to confirm the priority when these methods are used simultaneously. For example:
- If I define the same variable (
API_URL
) in botheas.json
and EAS Secrets, which one will take precedence? - If I use the
--env
flag, will it override the other two?
Additionally, I'd like to know the best practices for managing environment variables, especially in cases where:
- I have sensitive keys (e.g., API keys).
- I need to differentiate between development and production environments.
I am using Expo's EAS Build and have learned there are three ways to define environment variables:
eas.json
: Adding the variables directly in the env property of each build profile.- EAS Secrets: Storing sensitive variables securely using the
eas secret:create
command. - Command-line flag: Passing variables with the
--env
flag during the build command.
I want to confirm the priority when these methods are used simultaneously. For example:
- If I define the same variable (
API_URL
) in botheas.json
and EAS Secrets, which one will take precedence? - If I use the
--env
flag, will it override the other two?
Additionally, I'd like to know the best practices for managing environment variables, especially in cases where:
- I have sensitive keys (e.g., API keys).
- I need to differentiate between development and production environments.
1 Answer
Reset to default 1EAS Secrets is where you should put all your env variable at the end (as CI-CD pipeline) and is the one that will overwrite others values.
--env and the env object in eas.json are the same thing.
about sensitiveness, it's depend which level of security you want to put on your variable in the EAS Secrets variables manager (visible, masked or secret). Secret level is for value you don't want either other people on your team to see or leak by mistake.
Sensitive data such as API KEY should be stored at least at masked level.
You can restrict you variable on specific environnement in EAS Secrets, which let's you configure them more efficiently.
Also a little warn, if you put data on masked or secrets level, be sure to not use them with EXPO_PUBLIC_ prefix in your app, else it will be visible for anyone who install your application.
本文标签:
版权声明:本文标题:expo - What is the priority of environment variables in EAS Build, and what are the best practices? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736303735a1931989.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论