Commit 6a32be00 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'ff-app-name-instructions' into 'master'

Update Documentation for Configuring Feature Flag Clients

See merge request gitlab-org/gitlab!37255
parents 540e5aa1 f5258c3e
...@@ -196,9 +196,11 @@ To get the access credentials that your application needs to communicate with Gi ...@@ -196,9 +196,11 @@ To get the access credentials that your application needs to communicate with Gi
1. Click the **Configure** button to view the following: 1. Click the **Configure** button to view the following:
- **API URL**: URL where the client (application) connects to get a list of feature flags. - **API URL**: URL where the client (application) connects to get a list of feature flags.
- **Instance ID**: Unique token that authorizes the retrieval of the feature flags. - **Instance ID**: Unique token that authorizes the retrieval of the feature flags.
- **Application name**: The name of the running environment. For instance, - **Application name**: The name of the *environment* the application runs in
if the application runs for a production server, the application name would be (not the name of the application itself).
`production` or similar. This value is used for the environment spec evaluation.
For example, if the application runs for a production server, the **Application name**
could be `production` or similar. This value is used for the environment spec evaluation.
NOTE: **Note:** NOTE: **Note:**
The meaning of these fields might change over time. For example, we are not sure The meaning of these fields might change over time. For example, we are not sure
...@@ -247,7 +249,7 @@ func init() { ...@@ -247,7 +249,7 @@ func init() {
unleash.Initialize( unleash.Initialize(
unleash.WithUrl("https://gitlab.com/api/v4/feature_flags/unleash/42"), unleash.WithUrl("https://gitlab.com/api/v4/feature_flags/unleash/42"),
unleash.WithInstanceId("29QmjsW6KngPR5JNPMWx"), unleash.WithInstanceId("29QmjsW6KngPR5JNPMWx"),
unleash.WithAppName("production"), unleash.WithAppName("production"), // Set to the running environment of your application
unleash.WithListener(&metricsInterface{}), unleash.WithListener(&metricsInterface{}),
) )
} }
...@@ -280,7 +282,7 @@ require 'unleash/context' ...@@ -280,7 +282,7 @@ require 'unleash/context'
unleash = Unleash::Client.new({ unleash = Unleash::Client.new({
url: 'http://gitlab.com/api/v4/feature_flags/unleash/42', url: 'http://gitlab.com/api/v4/feature_flags/unleash/42',
app_name: 'production', app_name: 'production', # Set to the running environment of your application
instance_id: '29QmjsW6KngPR5JNPMWx' instance_id: '29QmjsW6KngPR5JNPMWx'
}) })
......
<script> <script>
import { GlModal, GlDeprecatedButton, GlTooltipDirective, GlLoadingIcon } from '@gitlab/ui'; import {
GlModal,
GlDeprecatedButton,
GlTooltipDirective,
GlLoadingIcon,
GlSprintf,
GlLink,
} from '@gitlab/ui';
import { s__, __, sprintf } from '~/locale'; import { s__, __, sprintf } from '~/locale';
import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue'; import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -24,6 +31,8 @@ export default { ...@@ -24,6 +31,8 @@ export default {
Icon, Icon,
Callout, Callout,
GlLoadingIcon, GlLoadingIcon,
GlSprintf,
GlLink,
}, },
directives: { directives: {
...@@ -35,7 +44,11 @@ export default { ...@@ -35,7 +44,11 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
helpAnchor: { helpClientLibrariesPath: {
type: String,
required: true,
},
helpClientExamplePath: {
type: String, type: String,
required: true, required: true,
}, },
...@@ -73,7 +86,7 @@ export default { ...@@ -73,7 +86,7 @@ export default {
'FeatureFlags|Install a %{docs_link_anchored_start}compatible client library%{docs_link_anchored_end} and specify the API URL, application name, and instance ID during the configuration setup. %{docs_link_start}More Information%{docs_link_end}', 'FeatureFlags|Install a %{docs_link_anchored_start}compatible client library%{docs_link_anchored_end} and specify the API URL, application name, and instance ID during the configuration setup. %{docs_link_start}More Information%{docs_link_end}',
), ),
{ {
docs_link_anchored_start: `<a href="${this.helpAnchor}" target="_blank">`, docs_link_anchored_start: `<a href="${this.helpClientLibrariesPath}" target="_blank">`,
docs_link_anchored_end: '</a>', docs_link_anchored_end: '</a>',
docs_link_start: `<a href="${this.helpPath}" target="_blank">`, docs_link_start: `<a href="${this.helpPath}" target="_blank">`,
docs_link_end: '</a>', docs_link_end: '</a>',
...@@ -167,5 +180,18 @@ export default { ...@@ -167,5 +180,18 @@ export default {
category="info" category="info"
:message="$options.instanceIdRegenerateText" :message="$options.instanceIdRegenerateText"
/> />
<callout category="warning">
<gl-sprintf
:message="
s__(
'FeatureFlags|Set the Unleash client application name to the name of the environment your application runs in. This value is used to match environment scopes. See the %{linkStart}example client configuration%{linkEnd}.',
)
"
>
<template #link="{ content }">
<gl-link :href="helpClientExamplePath" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
</callout>
</gl-modal> </gl-modal>
</template> </template>
...@@ -66,7 +66,11 @@ export default { ...@@ -66,7 +66,11 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
featureFlagsAnchoredHelpPagePath: { featureFlagsClientLibrariesHelpPagePath: {
type: String,
required: true,
},
featureFlagsClientExampleHelpPagePath: {
type: String, type: String,
required: true, required: true,
}, },
...@@ -243,7 +247,8 @@ export default { ...@@ -243,7 +247,8 @@ export default {
<configure-feature-flags-modal <configure-feature-flags-modal
v-if="canUserConfigure" v-if="canUserConfigure"
:help-path="featureFlagsHelpPagePath" :help-path="featureFlagsHelpPagePath"
:help-anchor="featureFlagsAnchoredHelpPagePath" :help-client-libraries-path="featureFlagsClientLibrariesHelpPagePath"
:help-client-example-path="featureFlagsClientExampleHelpPagePath"
:api-url="unleashApiUrl" :api-url="unleashApiUrl"
:instance-id="instanceId" :instance-id="instanceId"
:is-rotating="isRotating" :is-rotating="isRotating"
......
...@@ -20,7 +20,9 @@ export default () => ...@@ -20,7 +20,9 @@ export default () =>
projectId: this.dataset.projectId, projectId: this.dataset.projectId,
errorStateSvgPath: this.dataset.errorStateSvgPath, errorStateSvgPath: this.dataset.errorStateSvgPath,
featureFlagsHelpPagePath: this.dataset.featureFlagsHelpPagePath, featureFlagsHelpPagePath: this.dataset.featureFlagsHelpPagePath,
featureFlagsAnchoredHelpPagePath: this.dataset.featureFlagsAnchoredHelpPagePath, featureFlagsClientLibrariesHelpPagePath: this.dataset
.featureFlagsClientLibrariesHelpPagePath,
featureFlagsClientExampleHelpPagePath: this.dataset.featureFlagsClientExampleHelpPagePath,
unleashApiUrl: this.dataset.unleashApiUrl, unleashApiUrl: this.dataset.unleashApiUrl,
unleashApiInstanceId: this.dataset.unleashApiInstanceId || '', unleashApiInstanceId: this.dataset.unleashApiInstanceId || '',
csrfToken: csrf.token, csrfToken: csrf.token,
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
#feature-flags-vue{ data: { endpoint: project_feature_flags_path(@project, format: :json), #feature-flags-vue{ data: { endpoint: project_feature_flags_path(@project, format: :json),
"project-id" => @project.id, "project-id" => @project.id,
"error-state-svg-path" => image_path('illustrations/feature_flag.svg'), "error-state-svg-path" => image_path('illustrations/feature_flag.svg'),
"feature-flags-help-page-path" => help_page_path("user/project/operations/feature_flags"), "feature-flags-help-page-path" => help_page_path("operations/feature_flags"),
"feature-flags-anchored-help-page-path" => help_page_path("user/project/operations/feature_flags", anchor: "client-libraries"), "feature-flags-client-libraries-help-page-path" => help_page_path("operations/feature_flags", anchor: "choose-a-client-library"),
"feature-flags-client-example-help-page-path" => help_page_path("operations/feature_flags", anchor: "golang-application-example"),
"unleash-api-url" => (unleash_api_url(@project) if can?(current_user, :admin_feature_flag, @project)), "unleash-api-url" => (unleash_api_url(@project) if can?(current_user, :admin_feature_flag, @project)),
"unleash-api-instance-id" => (unleash_api_instance_id(@project) if can?(current_user, :admin_feature_flag, @project)), "unleash-api-instance-id" => (unleash_api_instance_id(@project) if can?(current_user, :admin_feature_flag, @project)),
"can-user-admin-feature-flag" => can?(current_user, :admin_feature_flag, @project), "can-user-admin-feature-flag" => can?(current_user, :admin_feature_flag, @project),
......
---
title: Clarify that Unleash client app name must be the running environment name
merge_request: 37255
author:
type: other
...@@ -11,7 +11,8 @@ describe('Configure Feature Flags Modal', () => { ...@@ -11,7 +11,8 @@ describe('Configure Feature Flags Modal', () => {
beforeEach(() => { beforeEach(() => {
propsData = { propsData = {
helpPath: '/help/path', helpPath: '/help/path',
helpAnchor: '/help/path/#flags', helpClientLibrariesPath: '/help/path/#flags',
helpClientExamplePath: '/feature-flags#clientexample',
apiUrl: '/api/url', apiUrl: '/api/url',
instanceId: 'instance-id-token', instanceId: 'instance-id-token',
isRotating: false, isRotating: false,
......
...@@ -21,7 +21,8 @@ describe('Feature flags', () => { ...@@ -21,7 +21,8 @@ describe('Feature flags', () => {
csrfToken: 'testToken', csrfToken: 'testToken',
errorStateSvgPath: '/assets/illustrations/feature_flag.svg', errorStateSvgPath: '/assets/illustrations/feature_flag.svg',
featureFlagsHelpPagePath: '/help/feature-flags', featureFlagsHelpPagePath: '/help/feature-flags',
featureFlagsAnchoredHelpPagePath: '/help/feature-flags#unleash-clients', featureFlagsClientLibrariesHelpPagePath: '/help/feature-flags#unleash-clients',
featureFlagsClientExampleHelpPagePath: '/help/feature-flags#client-example',
userListsApiDocPath: '/help/api/user_lists', userListsApiDocPath: '/help/api/user_lists',
unleashApiUrl: `${TEST_HOST}/api/unleash`, unleashApiUrl: `${TEST_HOST}/api/unleash`,
unleashApiInstanceId: 'oP6sCNRqtRHmpy1gw2-F', unleashApiInstanceId: 'oP6sCNRqtRHmpy1gw2-F',
...@@ -96,7 +97,8 @@ describe('Feature flags', () => { ...@@ -96,7 +97,8 @@ describe('Feature flags', () => {
featureFlagsHelpPagePath: '/help/feature-flags', featureFlagsHelpPagePath: '/help/feature-flags',
canUserConfigure: false, canUserConfigure: false,
canUserRotateToken: false, canUserRotateToken: false,
featureFlagsAnchoredHelpPagePath: '/help/feature-flags#unleash-clients', featureFlagsClientLibrariesHelpPagePath: '/help/feature-flags#unleash-clients',
featureFlagsClientExampleHelpPagePath: '/help/feature-flags#client-example',
unleashApiUrl: `${TEST_HOST}/api/unleash`, unleashApiUrl: `${TEST_HOST}/api/unleash`,
unleashApiInstanceId: 'oP6sCNRqtRHmpy1gw2-F', unleashApiInstanceId: 'oP6sCNRqtRHmpy1gw2-F',
projectId: '8', projectId: '8',
......
...@@ -10309,6 +10309,9 @@ msgstr "" ...@@ -10309,6 +10309,9 @@ msgstr ""
msgid "FeatureFlags|Rollout Strategy" msgid "FeatureFlags|Rollout Strategy"
msgstr "" msgstr ""
msgid "FeatureFlags|Set the Unleash client application name to the name of the environment your application runs in. This value is used to match environment scopes. See the %{linkStart}example client configuration%{linkEnd}."
msgstr ""
msgid "FeatureFlags|Status" msgid "FeatureFlags|Status"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment