Open JeremyBradshaw7 opened 2 years ago
Can you give an example of how it used to work with react-native-config
?
What does the rnuc utility write to the android project by the way? Whatever it is seems to disappear after running yarn so I've put a postinstall script in my package.json to run yarn rnuc .env - again if that's the best way perhaps it could be added to the readme.
can you please elaborate on this a bit? can you suggest exact copy which could help to avoid this confusion? Feel free to submit pr too =)
Can you give an example of how it used to work with
react-native-config
?
react-native-config
relied in setting an ENVFILE
environment variable to point to whatever .env file should be the source of all config variables, so to expose the variables from that file in a script what I had was:
set -o allexport; source $ENVFILE; set +o allexport
I don't recall where I got this from however, it's not in their README - I think maybe I plucked it from this thread. I just need to know the recommended way to access the settings from this package's "current" config in a shell script.
Ok. While I do not natively support this it is still possible to simply source
your env file as long as this file is a dotenv one.
If you're using YAML then it's going to be tricky but using xcconfig maybe an acceptable workaround.
If your just trying to add secrets from yoour bash profile you could try this:
module.exports = {
js_override: true,
on_env: async function (env) {
// append process.env
return {
...env,
API_KEY: process.env._API_KEY
}
}
};
I'm migrating from react-native-config and trying to access some of the environment variables from a shell script after initiating the rnuc utility. I have this working like this which is an adjustment from how I had it working from react-native-config:
But is there a better/simpler recommended way? I cant see it in the docs.
What does the rnuc utility write to the android project by the way? Whatever it is seems to disappear after running
yarn
so I've put apostinstall
script in mypackage.json
to runyarn rnuc .env
- again if that's the best way perhaps it could be added to the readme.