Skip to content

Bring some 12 factor love to your mobile apps!

License

Notifications You must be signed in to change notification settings

hollyoops/react-native-config

 
 

Repository files navigation

Config variables for React Native apps

Module to expose config variables to your javascript code in React Native, supporting both iOS and Android.

Bring some 12 factor love to your mobile apps!

IMPORTANT

This repo just folk from react-native-config to fix some bugs and there is a new library react-native-env is on the way!

To view more usage just refer to react-native-env

Basic Usage

Create a new file .env in the root of your React Native app:

API_URL=https://myapi.com
GOOGLE_MAPS_API_KEY=abcdefgh

Then access variables defined there from your app:

import Config from "react-native-config";

Config.API_URL; // 'https://myapi.com'
Config.GOOGLE_MAPS_API_KEY; // 'abcdefgh'

Keep in mind this module doesn't obfuscate or encrypt secrets for packaging, so do not store sensitive keys in .env. It's basically impossible to prevent users from reverse engineering mobile app secrets, so design your app (and APIs) with that in mind.

About

Bring some 12 factor love to your mobile apps!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 31.6%
  • Java 25.1%
  • Ruby 24.6%
  • Python 10.4%
  • JavaScript 8.3%