Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3366036
D12927.id43155.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12927.id43155.diff
View Options
diff --git a/keyserver/src/keyserver.js b/keyserver/src/keyserver.js
--- a/keyserver/src/keyserver.js
+++ b/keyserver/src/keyserver.js
@@ -47,7 +47,10 @@
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 {
+ isPrimaryNode,
+ isSecondaryNode,
+} from './utils/primary-secondary-utils.js';
import { getRunServerConfig } from './utils/server-utils.js';
import {
prefetchAllURLFacts,
@@ -131,20 +134,32 @@
} else {
// Allow login to be optional until staging environment is available
try {
- // We await here to ensure that the keyserver has been provisioned a
- // commServicesAccessToken. In the future, this will be necessary for
- // many keyserver operations.
- const identityInfo = await verifyUserLoggedIn();
+ await (async () => {
+ // Should not be run by Landing or WebApp nodes
+ if (!isPrimaryNode && !isSecondaryNode) {
+ return;
+ }
+
+ // We await here to ensure that the keyserver has been provisioned a
+ // commServicesAccessToken. In the future, this will be necessary for
+ // many keyserver operations.
+ const identityInfo = await verifyUserLoggedIn();
+
+ if (!isPrimaryNode) {
+ return;
+ }
- if (isPrimaryNode) {
// We don't await here, as Tunnelbroker communication is not needed
// for normal keyserver behavior yet. In addition, this doesn't
// return information useful for other keyserver functions.
ignorePromiseRejections(createAndMaintainTunnelbrokerWebsocket(null));
- if (process.env.NODE_ENV === 'development') {
- await createAuthoritativeKeyserverConfigFiles(identityInfo.userId);
+
+ if (process.env.NODE_ENV !== 'development') {
+ return;
}
- }
+
+ await createAuthoritativeKeyserverConfigFiles(identityInfo.userId);
+ })();
} catch (e) {
console.warn(
'Failed identity login. Login optional until staging environment is available',
diff --git a/keyserver/src/utils/primary-secondary-utils.js b/keyserver/src/utils/primary-secondary-utils.js
--- a/keyserver/src/utils/primary-secondary-utils.js
+++ b/keyserver/src/utils/primary-secondary-utils.js
@@ -3,3 +3,7 @@
export const isPrimaryNode: boolean = process.env.COMM_NODE_ROLE
? process.env.COMM_NODE_ROLE === 'primary'
: true;
+
+export const isSecondaryNode: boolean = process.env.COMM_NODE_ROLE
+ ? process.env.COMM_NODE_ROLE === 'secondary'
+ : false;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 9:14 AM (20 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2581377
Default Alt Text
D12927.id43155.diff (2 KB)
Attached To
Mode
D12927: [keyserver] Do not verify identity logged for webapp and landing
Attached
Detach File
Event Timeline
Log In to Comment