
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-native-propsenv
Advanced tools
About Support load multiple environment variables by properties file for react native
This is base on the https://www.npmjs.com/package/react-native-dotenv, and match to propsenv.
# with npm
npm install react-native-propsenv
# or with Yarn
yarn add react-native-propsenv
As early as possible in your application, require and configure propsenv.
{
"plugins": [
["module:react-native-propsenv"]
]
}
{
"plugins": [
["module:react-native-propsenv", {
moduleName: '@env',
path: './env/',
whitelist: ['TEST'],
blacklist: ['TOKEN'],
allowUndefined: true,
debug: true,
profile: development,
}]
]
}
Create a env_<env>.properties file in the root/env/ directory of your project. Add environment-specific variables on new lines in the form of NAME=VALUE. For example:
HOST=localhost.local
USER=root
PASS=pass
You can also create multiple env_<env>.properties file in the directory.
# <root>/env
env_dev.properties
env_test.properties
env_prod.properties
Then execute your start script before with NODE_ENV=, you will get the configured variables in to env_.properties file by process.env.HOST, process.env.USER, process.env.PASS
RN_PROPS_ENV=test node your_script.js
Use in your code
import {HOST, USER} from '@env'
console.log('HOST', HOST)
console.log('USER', USER)
if you are meet the babel production cannot use issue, please configure the babel file as below:
module.exports = {
"presets": [
"module:metro-react-native-babel-preset"
],
"plugins": [
["module:react-native-propsenv", {
debug: false,
path: './env/',
moduleName: '@env',
profile: "production"
}]
],
"env": {
"development": {
"plugins": [
["module:react-native-propsenv", {
debug: false,
path: './env/',
moduleName: '@env',
profile: "development"
}]
]
}
}
}
FAQs
About Support load multiple environment variables by properties file for react native
We found that react-native-propsenv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.