-
Notifications
You must be signed in to change notification settings - Fork 899
Feature Flags
Greg Schueler edited this page Nov 8, 2019
·
1 revision
New features should be added using "feature flags", with a default value of "disabled" for new features.
Once the feature is ready it can be set to enabled by default.
Rundeck has a featureService
already, which allows testing whether a feature is enabled:
Use in a grails service, or spring bean:
class MyService implements InitializingBean{
def featureService
def enabled=false
def afterPropertiesSet() throws Exception {
this.enabled= featureService.featurePresent('myFeature', false)
}
}
Use in a GSP file to hide/show certain content:
<feature:enabled name="myFeature">
Cool feature stuff here
</feature:enabled>
or use the isEnabled/isDisabled to return a value
<g:set var="myFeatureEnabled" value="${feature.isEnabled(name:'myFeature')}"/>
The pattern for feature toggles is:
rundeck.feature.FeatureName.enabled=true/false
If you want this to be enabled by default in Dev or Production mode, add it to the application.groovy
file.
In some cases, you may need to add new spring resources for your feature, but only if your feature is enabled.
You can check the application config in the resources.groovy for the config value:
if(application.config.rundeck.feature?.MyFeature?.enabled in ['true',true]) {
//add bean
}