Question about Environment Variables for Local Builds

I’ve been going through the documentation for Environment variables and secrets:

I believe I understand most of what’s being explained here, but I have a couple of questions when it comes to local builds:

  • If I understand local builds correctly, they won’t take into consideration any files included in either .gitignore or .easignore. That means that files that we don’t push to the repo (like files with keys / secrets) won’t be used in the build, correct? If I add a secret via eas secret:create, will it use that on local builds as well?
  • If the answer is no, what would generally be the workaround? (other than just feeding the variable directly to the eas build --local command) What would generally be the workaround for secret files? (google_services.json, for example)

Thanks!

Not sure if this directly answers your question, but others may find it useful:

This is the way I use eas secrets. I will give the example when I use a fiirebase api key in my .config.js

  1. create a .env file, and define a variable (e.g.myApiKey) that stores the api key value like this:
    myApiKey = ‘my-api-key-token’;

You can then add this .env to your gitignore list

  1. go to your project in eas and create a secret with the exact same name as you have named your variable in the .env file. The secret must be named exactly same: so, in this example, as myApiKey and then add the secret token ‘my-api-key-token’

  2. modify your app.config.js extra.eas block:
    extra: {
    eas: {
    firebaseApiKey: process.env. myApiKey,
    },
    },

  3. Your config.js
    import Constants from ‘expo-constants’;

export const firebaseConfig = {
apiKey: Constants.expoConfig.extra.eas.firebaseApiKey,

};

with this, your config.js does not need to be in gitignore

  1. anytime you start the project, instead of npx expo start, type this:

myApiKey=‘my-api-key-token’ npx expo start