Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/config/dynamic/dynamic.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { type ClustersConfigs } from './resolvers/clusters.types';
import cronListEnabled from './resolvers/cron-list-enabled';
import extendedDomainInfoEnabled from './resolvers/extended-domain-info-enabled';
import { type ExtendedDomainInfoEnabledConfig } from './resolvers/extended-domain-info-enabled.types';
import failoverHistoryEnabled from './resolvers/failover-history-enabled';
import workflowActionsEnabled from './resolvers/workflow-actions-enabled';
import {
type WorkflowActionsEnabledResolverParams,
Expand Down Expand Up @@ -65,6 +66,12 @@ const dynamicConfigs: {
'request',
true
>;
FAILOVER_HISTORY_ENABLED: ConfigAsyncResolverDefinition<
undefined,
boolean,
'request',
true
>;
} = {
CADENCE_WEB_PORT: {
env: 'CADENCE_WEB_PORT',
Expand Down Expand Up @@ -109,6 +116,11 @@ const dynamicConfigs: {
evaluateOn: 'request',
isPublic: true,
},
FAILOVER_HISTORY_ENABLED: {
resolver: failoverHistoryEnabled,
evaluateOn: 'request',
isPublic: true,
},
} as const;

export default dynamicConfigs;
15 changes: 15 additions & 0 deletions src/config/dynamic/resolvers/failover-history-enabled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* WIP: Returns whether failover history APIs and UI are enabled.
*
* To enable the failover history tab, set the CADENCE_FAILOVER_HISTORY_ENABLED env variable to true.
* For further customization, override the implementation of this resolver.
*
* Server version behaviour:
* - > 1.3.6 (still hasn't been released yet): The Failover History API will work as expected.
* - <= 1.3.6: The Failover History API will return a GRPC unimplemented error (maps to HTTP 404 in the client).
*
* @returns {Promise<boolean>} Whether failover history UI is enabled.
*/
export default async function failoverHistoryEnabled(): Promise<boolean> {
return process.env.CADENCE_FAILOVER_HISTORY_ENABLED === 'true';
}
4 changes: 4 additions & 0 deletions src/config/dynamic/resolvers/schemas/resolver-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ const resolverSchemas: ResolverSchemas = {
args: z.undefined(),
returnType: z.boolean(),
},
FAILOVER_HISTORY_ENABLED: {
args: z.undefined(),
returnType: z.boolean(),
},
};

export default resolverSchemas;
1 change: 1 addition & 0 deletions src/utils/config/__fixtures__/resolved-config-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ const mockResolvedConfigValues: LoadedConfigResolvedValues = {
},
WORKFLOW_DIAGNOSTICS_ENABLED: false,
ARCHIVAL_DEFAULT_SEARCH_ENABLED: false,
FAILOVER_HISTORY_ENABLED: false,
};
export default mockResolvedConfigValues;