cds-snc / ircc-rescheduler

🙅🗓
https://vancouver.rescheduler-dev.cds-snc.ca/
MIT License
24 stars 7 forks source link

Setup feature flags #428

Closed timarney closed 6 years ago

timarney commented 6 years ago

What's a feature flag?

A feature flag provides an alternative to maintaining multiple feature branches, such that a feature can exist before it's ready for release. Features can be enable or disabled the at run time. I.e. we can hide a feature until we're ready to deploy it to all users.

For this setup a flags env variable has been added to allow toggling features

RAZZLE_FLAGS="[{"name":"nextButton","isActive":true}]"

We can now use the flags using the renderOn and renderOff properties

<Flags
    authorizedFlags={['nextButton']}
    renderOn={() => (
     <Button disabled={submitting}>
           <Trans>Next</Trans>
     </Button>
   )}
  renderOff={() => (
   <Button disabled={submitting}>
    <Trans>Review request</Trans>
     </Button>
       )}
   />