Last active
May 9, 2020 05:10
-
-
Save prokizzle/4d9ad745d4b9f1b5d5b5ca660240fd4e to your computer and use it in GitHub Desktop.
Feature Flags
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
const { filter, test, keys, fromPairs, map, match } = require('ramda'); | |
const env = dotenv.config({ path: ".env.local" }).parsed; | |
const featureKeys = filter(test(/^FEATURE/), keys(env)); | |
const FeatureFlags = fromPairs(map(key => [match(/FEATURE_([\w\W]+)/, key)[1], env[key]], featureKeys)); | |
module.exports = {plugins: [new webpack.DefinePlugin({ ...env, FeatureFlags })]}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment