Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BACK-43] jellyfish updates based on reuse of legacy _id for migration #203

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
13 changes: 0 additions & 13 deletions env.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,6 @@ module.exports = (function () {
env.mongo = {
connectionString: cs('data'),
};

// users who are going to upload via platform during migration
var usersFile = fs.readFileSync(__dirname + '/platform_users.json');
var platformUsers = JSON.parse(usersFile);
if (!Array.isArray(platformUsers)){
throw new Error(
'Must contain an array in platform_users.json'
);
}

env.uploader = {
platformUsers: platformUsers.map(item => item.toLowerCase().trim()),
};

return env;
})();
4 changes: 2 additions & 2 deletions lib/jellyfishService.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function createServer(
var uploaderDestination = null;

if (request.params.userId) {
if (serverConfig.uploader.platformUsers.includes(request.params.userId.trim().toLowerCase())) {
if (schemaEnv.platformUserIds.includes(request.params.userId.trim().toLowerCase())) {
uploaderDestination = 'platform';
}else{
uploaderDestination = 'jellyfish';
Expand All @@ -184,12 +184,12 @@ function createServer(
},
versions: {
uploaderMinimum: schemaEnv.minimumUploaderVersion,
uploaderDestination,
loop: {
minimumSupported: loop.minimumVersion,
criticalUpdateNeeded: loop.criticalUpdateVersions,
},
},
uploaderDestination,
};
response.status(200).send(body);
});
Expand Down
13 changes: 12 additions & 1 deletion lib/schema/schemaEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,21 @@ module.exports = (function () {

// The version that we will accept upload requests from, will be in format of 0.200.0
// NOTE: This will probably be eliminated in favor of using schemaVersion above for the same purpose
schemaEnv.minimumUploaderVersion = config.fromEnvironment('MINIMUM_UPLOADER_VERSION', '2.53.0');
schemaEnv.minimumUploaderVersion = config.fromEnvironment(
'MINIMUM_UPLOADER_VERSION',
'2.53.0'
);

schemaEnv.authRealm = config.fromEnvironment('KEYCLOAK_AUTH_REALM', null);
schemaEnv.authUrl = config.fromEnvironment('KEYCLOAK_AUTH_URL', null);
var usersStr = config.fromEnvironment('UPLOADER_PLATFORM_USER_IDS', null);
var platformUsers = [];
if (usersStr) {
platformUsers = usersStr
.split(',')
.map((item) => item.toLowerCase().trim());
}
schemaEnv.platformUserIds = platformUsers;
darinkrauss marked this conversation as resolved.
Show resolved Hide resolved

return schemaEnv;
})();
1 change: 0 additions & 1 deletion platform_api_users.json

This file was deleted.