Last active
June 1, 2018 13:33
-
-
Save peterpme/c34f1f1879f673a1f55c4cbb6444794e to your computer and use it in GitHub Desktop.
Psuedo Environment Variables using Expo Release Channels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Constants } from 'expo' | |
const ENV = { | |
dev: { | |
apiUrl: 'http://localhost:1337/api' | |
}, | |
staging: { | |
apiUrl: 'https://staging.orchard.ai/api' | |
}, | |
prod: { | |
apiUrl: 'https://orchard.ai/api' | |
} | |
} | |
function getEnvVars(env = '') { | |
if (env === null || env === undefined || env === '') return ENV.dev | |
if (env.indexOf('dev') !== -1) return ENV.dev | |
if (env.indexOf('staging') !== -1) return ENV.staging | |
if (env.indexOf('prod') !== -1) return ENV.prod | |
} | |
export default getEnvVars(Constants.manifest.releaseChannel) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment