Skip to content

Commit 02ef22d

Browse files
Add feature flag for Failover History (#1070)
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
1 parent d7d94fb commit 02ef22d

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

src/config/dynamic/dynamic.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { type ClustersConfigs } from './resolvers/clusters.types';
1414
import cronListEnabled from './resolvers/cron-list-enabled';
1515
import extendedDomainInfoEnabled from './resolvers/extended-domain-info-enabled';
1616
import { type ExtendedDomainInfoEnabledConfig } from './resolvers/extended-domain-info-enabled.types';
17+
import failoverHistoryEnabled from './resolvers/failover-history-enabled';
1718
import workflowActionsEnabled from './resolvers/workflow-actions-enabled';
1819
import {
1920
type WorkflowActionsEnabledResolverParams,
@@ -65,6 +66,12 @@ const dynamicConfigs: {
6566
'request',
6667
true
6768
>;
69+
FAILOVER_HISTORY_ENABLED: ConfigAsyncResolverDefinition<
70+
undefined,
71+
boolean,
72+
'request',
73+
true
74+
>;
6875
} = {
6976
CADENCE_WEB_PORT: {
7077
env: 'CADENCE_WEB_PORT',
@@ -109,6 +116,11 @@ const dynamicConfigs: {
109116
evaluateOn: 'request',
110117
isPublic: true,
111118
},
119+
FAILOVER_HISTORY_ENABLED: {
120+
resolver: failoverHistoryEnabled,
121+
evaluateOn: 'request',
122+
isPublic: true,
123+
},
112124
} as const;
113125

114126
export default dynamicConfigs;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* WIP: Returns whether failover history APIs and UI are enabled.
3+
*
4+
* To enable the failover history tab, set the CADENCE_FAILOVER_HISTORY_ENABLED env variable to true.
5+
* For further customization, override the implementation of this resolver.
6+
*
7+
* Server version behaviour:
8+
* - > 1.3.6 (still hasn't been released yet): The Failover History API will work as expected.
9+
* - <= 1.3.6: The Failover History API will return a GRPC unimplemented error (maps to HTTP 404 in the client).
10+
*
11+
* @returns {Promise<boolean>} Whether failover history UI is enabled.
12+
*/
13+
export default async function failoverHistoryEnabled(): Promise<boolean> {
14+
return process.env.CADENCE_FAILOVER_HISTORY_ENABLED === 'true';
15+
}

src/config/dynamic/resolvers/schemas/resolver-schemas.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ const resolverSchemas: ResolverSchemas = {
6363
args: z.undefined(),
6464
returnType: z.boolean(),
6565
},
66+
FAILOVER_HISTORY_ENABLED: {
67+
args: z.undefined(),
68+
returnType: z.boolean(),
69+
},
6670
};
6771

6872
export default resolverSchemas;

src/utils/config/__fixtures__/resolved-config-values.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ const mockResolvedConfigValues: LoadedConfigResolvedValues = {
4242
},
4343
WORKFLOW_DIAGNOSTICS_ENABLED: false,
4444
ARCHIVAL_DEFAULT_SEARCH_ENABLED: false,
45+
FAILOVER_HISTORY_ENABLED: false,
4546
};
4647
export default mockResolvedConfigValues;

0 commit comments

Comments
 (0)