bestit / flagception-bundle

Feature flags on steroids!
MIT License
210 stars 42 forks source link

[Add] Memory activator #43

Open migo315 opened 5 years ago

migo315 commented 5 years ago

For some it is confusing that some activators (eg cookie, environment) share the "features" tree while others (eg database, contentful) are independent of it.

Therefore, it makes sense to pack the activators that share the same config together. Example:

# config.yml

flagception:   
    features: // moved under "memory"

    activators:    
        memory:
            enable: true
            strategy: all
            features:
                feature_foobar:
                    roles: USER_ROLE
                    cookie: true
                    strategy: all
                feature_bazz:
                    default: true
        database:
            // ...
        contentful:
            // ...
        prismic:
            // ...

The new MemoryActivator is an additional activator to prevent a BC. But in the long term, it should replace the old ArrayActivator, EnvironmentActivator, ConstraintActivator, and CookieActivator.

migo315 commented 5 years ago

The new Flagception Bundle 4.0 will work without the shared "features" tree. Each activator has his own feature tree (if needed) or work without them.

The new "MemoryActivator" will replace the old ArrayActivator and ConstraintActivator. You can define a boolean value or a constraint string (expression language).

# config.yml

flagception:   
    activators:    
        memory:
            enable: true
            features:
                feature_foobar: true
                feature_bazz: 'date("H") > 8 and date("H") < 18'
        database:
            // ...
        contentful:
            // ...
        cookie:
            // ...