Skip to content

All flags automatically enabled on dev environment? #473

Closed Answered by sergiodxa
simonfaltum asked this question in Q&A
Discussion options

You must be logged in to vote

Flagged doesn't have any way to get the flags by itself, you provide them, and they could be set at build time or at runtime, they could even come from the database/an API.

If you know your list of flags you can do the check yourself

let isDev = process.env.NODE_ENV !== "production"

return <FlagsProvider features={{ v2: isDev || featureFromAPI}}><App /></FlagsProvider>

Using a special env variables will mean the user of the lib needs to setup their build tool to replace process.env.FLAGGED_MAGIC_ENV with the value from process.env at build time, not all tools do that, Create React App requires a special prefix for env variables, same with Next, Remix doesn't even do that at all.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sergiodxa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants