@sjcrh/proteinpaint-server 2.97.0 → 2.98.1-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.
@@ -122,7 +122,14 @@ if (serverconfig.debugmode && !serverconfig.binpath.includes('sjcrh/')) {
122
122
  const defaultDir = path.join(serverconfig.binpath, 'src/test/routes')
123
123
  // will add testing routes as needed and if found, such as in dev environment
124
124
  const testRouteSetters = ['gdc.js', 'specs.js', 'readme.js']
125
- if (serverconfig.sse !== false) testRouteSetters.push('sse.js')
125
+ if (serverconfig.features.sse === undefined) serverconfig.features.sse = true
126
+ if (typeof serverconfig.features.sse !== 'boolean') {
127
+ throw `serverconfig.features.sse must be either undefined or boolean`
128
+ }
129
+ // !!! if the sse route code file is detected as missing,
130
+ // features.sse will be reset to false below in testRouteSetters loop
131
+ // to prevent the client from attempting a connection !!!
132
+ if (serverconfig.features.sse) testRouteSetters.push('sse.js')
126
133
 
127
134
  if (serverconfig.routeSetters) {
128
135
  for (const f of serverconfig.routeSetters) {
@@ -142,6 +149,7 @@ if (serverconfig.debugmode && !serverconfig.binpath.includes('sjcrh/')) {
142
149
  const absf = `${defaultDir}/${f}`
143
150
  // avoid duplicate entries; these test route setters should only exist in dev environment and not deployed to prod
144
151
  if (!routeSetters.includes(absf) && fs.existsSync(absf)) routeSetters.push(absf)
152
+ else if (f === 'sse.js') serverconfig.features.sse = false
145
153
  }
146
154
 
147
155
  // may replace the original routeSetters value,