@sjcrh/proteinpaint-server 2.138.2 → 2.138.3-1

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.
@@ -163,6 +163,13 @@ if (serverconfig.debugmode && !serverconfig.binpath.includes('sjcrh/')) {
163
163
  serverconfig.routeSetters = routeSetters
164
164
  }
165
165
 
166
+ if (serverconfig.debugmode) {
167
+ // should be able to run this in local dev and test environments that use containers
168
+ const hg38test = serverconfig.genomes.find(g => g.name == 'hg38-test')
169
+ // this internal function must be trusted to only modify test-related serverconfig entries
170
+ if (hg38test?.datasets) mayUpdateTestDatasets(hg38test.datasets, serverconfig)
171
+ }
172
+
166
173
  if (serverconfig.allow_env_overrides) {
167
174
  if (process.env.PP_URL) {
168
175
  serverconfig.URL = process.env.PP_URL
@@ -279,3 +286,45 @@ if (!serverconfig.cache_snpgt) {
279
286
  }
280
287
 
281
288
  export default serverconfig
289
+
290
+ /*
291
+ Option to add datasets under hg38-test and also feature flags, dsCredentials
292
+
293
+ datasets[]: the raw datasets array from a serverconfig genomes entry
294
+ serverconfig
295
+ */
296
+ function mayUpdateTestDatasets(datasets, serverconfig) {
297
+ const ds = datasets.find(ds => ds.jsfile.includes('/termdb.test.'))
298
+ if (!ds) return
299
+ const fileExt = ds.jsfile.split('.').pop()
300
+ datasets.push({
301
+ name: 'ProtectedTest',
302
+ jsfile: `./dataset/protected.test.${fileExt}`
303
+ })
304
+
305
+ if (serverconfig.features.dslabelFilter?.includes('TermdbTest')) {
306
+ serverconfig.features.dslabelFilter.push('ProtectedTest')
307
+ }
308
+
309
+ if (!serverconfig.dsCredentials) serverconfig.dsCredentials = {}
310
+ serverconfig.dsCredentials.ProtectedTest = {
311
+ termdb: {
312
+ '*': {
313
+ type: 'jwt',
314
+ secret: 'fake-secret', // pragma: allowlist secret
315
+ dsnames: [
316
+ {
317
+ id: 'ABC',
318
+ label: 'ABC cohort',
319
+ role: 'admin',
320
+ sites: [1, 2, 5]
321
+ },
322
+ {
323
+ id: 'XYZ',
324
+ label: 'XYZ cohort'
325
+ }
326
+ ]
327
+ }
328
+ }
329
+ }
330
+ }