diff --git a/keyserver/src/keyserver.js b/keyserver/src/keyserver.js --- a/keyserver/src/keyserver.js +++ b/keyserver/src/keyserver.js @@ -47,6 +47,7 @@ import { initENSCache } from './utils/ens-cache.js'; import { initFCCache } from './utils/fc-cache.js'; import { getContentSigningKey } from './utils/olm-utils.js'; +import { isPrimaryNode } from './utils/primary-secondary-utils.js'; import { getRunServerConfig } from './utils/server-utils.js'; import { prefetchAllURLFacts, @@ -89,9 +90,6 @@ const isCPUProfilingEnabled = process.env.KEYSERVER_CPU_PROFILING_ENABLED; const areEndpointMetricsEnabled = process.env.KEYSERVER_ENDPOINT_METRICS_ENABLED; - const isPrimaryNode = process.env.COMM_NODE_ROLE - ? process.env.COMM_NODE_ROLE === 'primary' - : true; if (cluster.isMaster) { if (isPrimaryNode) { diff --git a/keyserver/src/utils/primary-secondary-utils.js b/keyserver/src/utils/primary-secondary-utils.js new file mode 100644 --- /dev/null +++ b/keyserver/src/utils/primary-secondary-utils.js @@ -0,0 +1,5 @@ +// @flow + +export const isPrimaryNode: boolean = process.env.COMM_NODE_ROLE + ? process.env.COMM_NODE_ROLE === 'primary' + : true;