@sjcrh/proteinpaint-server 2.138.2 → 2.138.3-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -161,6 +161,10 @@ if (serverconfig.debugmode && !serverconfig.binpath.includes('sjcrh/')) {
161
161
  // since the serverconfig.binpath prefix may
162
162
  // have been applied to locate optional routeSetter files
163
163
  serverconfig.routeSetters = routeSetters
164
+
165
+ const hg38test = serverconfig.genomes.find(g => g.name == 'hg38-test')
166
+ // this internal function must be trusted to only modify test-related serverconfig entries
167
+ if (hg38test?.datasets) mayUpdateTestDatasets(hg38test.datasets, serverconfig)
164
168
  }
165
169
 
166
170
  if (serverconfig.allow_env_overrides) {
@@ -279,3 +283,45 @@ if (!serverconfig.cache_snpgt) {
279
283
  }
280
284
 
281
285
  export default serverconfig
286
+
287
+ /*
288
+ Option to add datasets under hg38-test and also feature flags, dsCredentials
289
+
290
+ datasets[]: the raw datasets array from a serverconfig genomes entry
291
+ serverconfig
292
+ */
293
+ function mayUpdateTestDatasets(datasets, serverconfig) {
294
+ const ds = datasets.find(ds => ds.jsfile.includes('/termdb.test.'))
295
+ if (!ds) return
296
+ const fileExt = ds.jsfile.split('.').pop()
297
+ datasets.push({
298
+ name: 'ProtectedTest',
299
+ jsfile: `./dataset/protected.test.${fileExt}`
300
+ })
301
+
302
+ if (serverconfig.features.dslabelFilter?.includes('TermdbTest')) {
303
+ serverconfig.features.dslabelFilter.push('ProtectedTest')
304
+ }
305
+
306
+ if (!serverconfig.dsCredentials) serverconfig.dsCredentials = {}
307
+ serverconfig.dsCredentials.ProtectedTest = {
308
+ termdb: {
309
+ '*': {
310
+ type: 'jwt',
311
+ secret: 'fake-secret', // pragma: allowlist secret
312
+ dsnames: [
313
+ {
314
+ id: 'ABC',
315
+ label: 'ABC cohort',
316
+ role: 'admin',
317
+ sites: [1, 2, 5]
318
+ },
319
+ {
320
+ id: 'XYZ',
321
+ label: 'XYZ cohort'
322
+ }
323
+ ]
324
+ }
325
+ }
326
+ }
327
+ }