config.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. // 'pdbe',
  48. // 'rcsb',
  49. // 'wwpdb'
  50. ],
  51. params: {
  52. PDBe: {
  53. UseFileSource: false,
  54. API: {
  55. residuewise_outlier_summary: 'https://www.ebi.ac.uk/pdbe/api/validation/residuewise_outlier_summary/entry',
  56. preferred_assembly: 'https://www.ebi.ac.uk/pdbe/api/pdb/entry/summary',
  57. struct_ref_domain: 'https://www.ebi.ac.uk/pdbe/api/mappings/sequence_domains'
  58. },
  59. File: {
  60. residuewise_outlier_summary: 'e:/test/mol-star/model/props/'
  61. }
  62. },
  63. RCSB: {
  64. API: {
  65. assembly_symmetry: 'https://rest-staging.rcsb.org/graphql'
  66. }
  67. },
  68. wwPDB: {
  69. chemCompBondTablePath: ''
  70. }
  71. }
  72. },
  73. /**
  74. * Maps a request identifier to a filename.
  75. *
  76. * @param source
  77. * Source of the data.
  78. * @param id
  79. * Id provided in the request.
  80. */
  81. mapFile(source: string, id: string) {
  82. switch (source.toLowerCase()) {
  83. case 'pdb': return `e:/test/quick/${id}_updated.cif`;
  84. // case 'pdb': return `e:/test/mol-star/model/out/${id}_updated.bcif`;
  85. // case 'pdb-bcif': return `c:/test/mol-star/model/out/${id}_updated.bcif`;
  86. // case 'pdb-cif': return `c:/test/mol-star/model/out/${id}_updated.cif`;
  87. default: return void 0;
  88. }
  89. }
  90. };
  91. export default config;