Skip to content

Comment on Ask HN: Do you commit feature flags to Git?

Comments

I have a directory of feature flags IN THE REPO that look like this:

    $ cat default/setting/html/avatar_link_to_person_when_approved
    0
I then have a directory of local config (NOT in the repo) that look like this:
    $ cat config/setting/html/avatar_link_to_person_when_approved
    1
Then my feature flag code looks like this:
    if (GetConfig('setting/html/avatar_link_to_person_when_approved')) {
        # do some stuff
    }
Later on, when the feature is stable, and if it makes sense to make it a default feature, I can change the default without affecting existing installations.

The "feature flag tool" I use is a procedure called GetConfig() which is ~250 lines of code with comments and logic for overlays.

Please let me know if you have any questions about this method.

Nice. Something home grown effectively then? What kind of application are you building with?

I'm building a static site generator with optional dynamic components and lots of quirky features.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.