Skip to content
This repository has been archived by the owner on Apr 21, 2020. It is now read-only.

Commit

Permalink
add prefix to all environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jmz-b committed Apr 7, 2020
1 parent cac443b commit 234263b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions resources/catalog/somnonetz-pipeline/bin/upload_to_sse
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@ const { xnatID, host, user, pwd } = parser.parseArgs();
const XnatDataClient = '/data/xnat/pipeline/xnat-tools/XnatDataClient'
const args = ['-u', user, '-p', pwd, '-r', `${host}/REST/experiments/${xnatID}/scans/psg?format=json`];

const { SSE_URL, SSE_KEY_G, SSE_KENC, TA_URL, SALT_VALUE, IV_VALUE } = process.env;
const {
SSE_CLIENT_SSE_SERVER_URL,
SSE_CLIENT_KEY_G,
SSE_CLIENT_KENC,
SSE_CLIENT_TA_URL,
SSE_CLIENT_SALT_VALUE,
SSE_CLIENT_IV_VALUE
} = process.env;

if (!(SSE_URL && SSE_KEY_G && SSE_KENC && TA_URL && SALT_VALUE && IV_VALUE)) {
throw 'One or more of the following environment variables are not set: ' +
'SSE_URL, SSE_KEY_G, SSE_KENC, TA_URL, SALT_VALUE, IV_VALUE';
if (!(SSE_CLIENT_SSE_SERVER_URL && SSE_CLIENT_KEY_G && SSE_CLIENT_KENC && SSE_CLIENT_TA_URL && SSE_CLIENT_SALT_VALUE && SSE_CLIENT_IV_VALUE)) {
throw 'One or more of the following environment variables not set: ' +
'SSE_CLIENT_SSE_SERVER_URL, SSE_CLIENT_KEY_G, SSE_CLIENT_KENC, SSE_CLIENT_TA_URL, SSE_CLIENT_SALT_VALUE, SSE_CLIENT_IV_VALUE';
}

execFile(XnatDataClient, args, function callback(error, stdout, stderr) {
Expand All @@ -30,5 +37,5 @@ execFile(XnatDataClient, args, function callback(error, stdout, stderr) {
const session = JSON.parse(stdout);
const data = session.items[0].data_fields;

uploadData(data, data.image_session_ID, SSE_KEY_G, SSE_KENC);
uploadData(data, data.image_session_ID, SSE_CLIENT_KEY_G, SSE_CLIENT_KENC);
});

0 comments on commit 234263b

Please sign in to comment.