feat: allow specifying app level feature flags
application feature flags can be defined in the application creation. see docs/plugins/feature-flags.md for reference. closes #15553 Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
---
|
||||
id: feature-flags
|
||||
title: Feature Flags
|
||||
description: Details the process of defining setting and reading a plugin feature flag.
|
||||
description: Details the process of defining setting and reading a feature flag.
|
||||
---
|
||||
|
||||
Backstage offers the ability to define feature flags inside a plugin. This allows you to restrict parts of your plugin to those individual users who have toggled the feature flag to on.
|
||||
Backstage offers the ability to define feature flags inside a plugin or during application creation. This allows you to restrict parts of your plugin to those individual users who have toggled the feature flag to on.
|
||||
|
||||
This page describes the process of defining setting and reading a plugin feature flag. If you are looking for using feature flags with software templates that can be found under [Writing Templates](https://backstage.io/docs/features/software-templates/writing-templates#remove-sections-or-fields-based-on-feature-flags).
|
||||
This page describes the process of defining setting and reading a feature flag. If you are looking for using feature flags with software templates that can be found under [Writing Templates](https://backstage.io/docs/features/software-templates/writing-templates#remove-sections-or-fields-based-on-feature-flags).
|
||||
|
||||
## Defining a Feature Flag
|
||||
|
||||
Before using a feature flag we must first define it. This is done when we create the plugin by passing the name of the feature flag into the `featureFlags` array.
|
||||
### In a plugin
|
||||
|
||||
Defining feature flag in a plugin is done by passing the name of the feature flag into the `featureFlags` array:
|
||||
|
||||
```ts
|
||||
/* src/plugin.ts */
|
||||
@@ -26,6 +28,21 @@ export const examplePlugin = createPlugin({
|
||||
});
|
||||
```
|
||||
|
||||
### In the application
|
||||
|
||||
Defining feature flag in the application is done by adding feature flags in`featureFlags` array in
|
||||
`createApp()` function call:
|
||||
|
||||
```ts
|
||||
const app = createApp({
|
||||
// ...
|
||||
featureFlags: [
|
||||
{ name: 'tech-radar', description: 'Enables the tech radar plugin' },
|
||||
],
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
## Enabling Feature Flags
|
||||
|
||||
Feature flags are defaulted to off and can be updated by individual users in the backstage interface.
|
||||
|
||||
Reference in New Issue
Block a user