@sjcrh/proteinpaint-server 2.212.0 → 2.213.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.
@@ -46,6 +46,23 @@ if (!serverconfigfile) {
46
46
  }
47
47
  }
48
48
 
49
+ // Derived settings from a launcher script, such as the container app-server.mjs and app-full.mjs,
50
+ // applied as if these were in serverconfig.json. This avoids rewriting a mounted serverconfig.json,
51
+ // which may be read-only or not writable by the container user. Applied before any other processing,
52
+ // so that settings that are computed below, such as allowedEmbedders, reflect these values.
53
+ // Not deleted from process.env, so that spawned child processes that load this module apply the same values.
54
+ if (process.env.PP_SERVERCONFIG_OVERRIDES) {
55
+ let overrides
56
+ try {
57
+ overrides = JSON.parse(process.env.PP_SERVERCONFIG_OVERRIDES)
58
+ } catch (e) {
59
+ throw `invalid JSON in process.env.PP_SERVERCONFIG_OVERRIDES: ${e}`
60
+ }
61
+ if (!overrides || typeof overrides != 'object' || Array.isArray(overrides))
62
+ throw `process.env.PP_SERVERCONFIG_OVERRIDES must be a JSON object`
63
+ Object.assign(serverconfig, overrides)
64
+ }
65
+
49
66
  // this default port may be overwritten when using a Docker container
50
67
  if (!serverconfig.port) serverconfig.port = process.env.PP_PORT || 3000
51
68
  // default binary cmd paths
@@ -261,7 +278,8 @@ if (serverconfig.allow_env_overrides) {
261
278
  serverconfig.basepath = process.env.PP_BASEPATH
262
279
  }
263
280
 
264
- if (fs.existsSync('./.ssl') && !serverconfig.ssl) {
281
+ // `"ssl": false` skips loading a local ./.ssl dir
282
+ if (!serverconfig.ssl && serverconfig.ssl !== false && fs.existsSync('./.ssl')) {
265
283
  serverconfig.ssl = {}
266
284
  const files = fs.readdirSync('./.ssl')
267
285
  for (const filename of files) {