Skip to content

Instantly share code, notes, and snippets.

@peterpme
Last active June 1, 2018 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterpme/c34f1f1879f673a1f55c4cbb6444794e to your computer and use it in GitHub Desktop.
Save peterpme/c34f1f1879f673a1f55c4cbb6444794e to your computer and use it in GitHub Desktop.
Psuedo Environment Variables using Expo Release Channels
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