Read environment variable from command line

Hi,

I would like to know how to read environment variables that are set in the environment using something like the export command in bash like so:

export MY_VAR=foo
exp start 
// or MY_VAR=foo exp start 

and then read it during development as such:

console.log(process.env.MY_VAR); // should print foo

I read this related post and found out about react-native-dotenv package from this issue. However, none of them address the issue of simply exporting / reading an environment variable from within expo (non-ejected) code.

Thanks!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.