config.ts 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. */
  6. const config = {
  7. /**
  8. * Determine if and how long to cache entries after a request.
  9. */
  10. cacheParams: {
  11. useCache: true,
  12. maxApproximateSizeInBytes: 2 * 1014 * 1024 * 1024, // 2 GB
  13. entryTimeoutInMs: 10 * 60 * 1000 // 10 minutes
  14. },
  15. /**
  16. * Node (V8) sometimes exhibits GC related issues that significantly slow down the execution
  17. * (https://github.com/nodejs/node/issues/8670).
  18. *
  19. * Therefore an option is provided that automatically shuts down the server.
  20. * For this to work, the server must be run using a deamon (i.e. forever.js on Linux
  21. * or IISnode on Windows) so that the server is automatically restarted when the shutdown happens.
  22. */
  23. shutdownParams: {
  24. // 0 for off, server will shut down after this amount of minutes.
  25. timeoutMinutes: 24 * 60 /* a day */,
  26. // modifies the shutdown timer by +/- timeoutVarianceMinutes (to avoid multiple instances shutting at the same time)
  27. timeoutVarianceMinutes: 60
  28. },
  29. defaultPort: 1337,
  30. /**
  31. * Specify the prefix of the API, i.e.
  32. * <host>/<apiPrefix>/<API queries>
  33. */
  34. appPrefix: '/ModelServer',
  35. /**
  36. * The maximum time the server dedicates to executing a query.
  37. * Does not include the time it takes to read and export the data.
  38. */
  39. maxQueryTimeInMs: 5 * 1000,
  40. /** Maximum number of requests before "server busy" */
  41. maxQueueLength: 30,
  42. /**
  43. * Provide a property config or a path a JSON file with the config.
  44. */
  45. customProperties: <import('./property-provider').ModelPropertyProviderConfig | string>{
  46. sources: [
  47. './properties/pdbe',
  48. './properties/rcsb'
  49. ],
  50. params: {
  51. PDBe: {
  52. UseFileSource: false,
  53. API: {
  54. residuewise_outlier_summary: 'https://www.ebi.ac.uk/pdbe/api/validation/residuewise_outlier_summary/entry',
  55. preferred_assembly: 'https://www.ebi.ac.uk/pdbe/api/pdb/entry/summary',
  56. struct_ref_domain: 'https://www.ebi.ac.uk/pdbe/api/mappings/sequence_domains'
  57. },
  58. File: {
  59. residuewise_outlier_summary: 'e:/test/mol-star/model/props/'
  60. }
  61. }
  62. }
  63. },
  64. /**
  65. * Maps a request identifier to a filename.
  66. *
  67. * @param source
  68. * Source of the data.
  69. * @param id
  70. * Id provided in the request.
  71. */
  72. mapFile(source: string, id: string) {
  73. switch (source.toLowerCase()) {
  74. // case 'pdb': return `e:/test/quick/${id}_updated.cif`;
  75. case 'pdb': return `e:/test/mol-star/model/out/${id}_updated.bcif`;
  76. case 'pdb-bcif': return `c:/test/mol-star/model/out/${id}_updated.bcif`;
  77. case 'pdb-cif': return `c:/test/mol-star/model/out/${id}_updated.cif`;
  78. default: return void 0;
  79. }
  80. }
  81. };
  82. export default config;