Created
March 5, 2020 14:35
-
-
Save bogoslavskiy/46a4586c25f80aee1a99a67c107c3ae4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const ENV = { | |
development: { | |
port: 7000, | |
mongoURI: 'mongodb://localhost:27017/chat-app', | |
}, | |
production: { | |
port: 7000, | |
mongoURI: 'mongodb://localhost:27017/chat-app', | |
}, | |
staging: { | |
port: 7000, | |
mongoURI: 'mongodb://localhost:27017/chat-app', | |
} | |
}; | |
type ENV = 'development' | 'staging' | 'production'; | |
function getEnvVars(env: ENV) { | |
const config = ENV[env]; | |
if (config) { | |
return config; | |
} | |
console.log(config); | |
return ENV.development; | |
} | |
export const __DEV__ = process.env.NODE_ENV === 'development'; | |
export default getEnvVars((process.env.NODE_ENV as ENV)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment