vendure-config.hbs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. {{#if isTs }}import{{ else }}const{{/if}} {
  2. dummyPaymentHandler,
  3. DefaultJobQueuePlugin,
  4. DefaultSearchPlugin,{{#if isTs}}
  5. VendureConfig,{{/if}}
  6. } {{#if isTs}}from '@vendure/core'; {{ else }}= require('@vendure/core');{{/if}}
  7. {{#if isTs }}
  8. import { defaultEmailHandlers, EmailPlugin } from '@vendure/email-plugin';
  9. {{ else }}
  10. const { defaultEmailHandlers, EmailPlugin } = require('@vendure/email-plugin');
  11. {{/if}}
  12. {{#if isTs }}
  13. import { AssetServerPlugin } from '@vendure/asset-server-plugin';
  14. {{ else }}
  15. const { AssetServerPlugin } = require('@vendure/asset-server-plugin');
  16. {{/if}}
  17. {{#if isTs }}
  18. import { AdminUiPlugin } from '@vendure/admin-ui-plugin';
  19. {{ else }}
  20. const { AdminUiPlugin } = require('@vendure/admin-ui-plugin');
  21. {{/if}}
  22. {{#if isTs }}
  23. import path from 'path';
  24. {{ else }}
  25. const path = require('path');
  26. {{/if}}
  27. {{#if isTs}}export {{/if}}const config{{#if isTs}}: VendureConfig{{/if}} = {
  28. apiOptions: {
  29. port: 3000,
  30. adminApiPath: 'admin-api',
  31. adminApiPlayground: {
  32. settings: {
  33. 'request.credentials': 'include',
  34. }{{#if isTs}} as any{{/if}},
  35. },// turn this off for production
  36. adminApiDebug: true, // turn this off for production
  37. shopApiPath: 'shop-api',
  38. shopApiPlayground: {
  39. settings: {
  40. 'request.credentials': 'include',
  41. }{{#if isTs}} as any{{/if}},
  42. },// turn this off for production
  43. shopApiDebug: true,// turn this off for production
  44. },
  45. authOptions: {
  46. superadminCredentials: {
  47. identifier: '{{{ escapeSingle superadminIdentifier }}}',
  48. password: '{{{ escapeSingle superadminPassword }}}',
  49. },
  50. cookieOptions: {
  51. secret: process.env.COOKIE_SECRET || 'cookie-secret',
  52. },
  53. },
  54. dbConnectionOptions: {
  55. type: '{{ dbType }}',
  56. synchronize: true, // turn this off for production
  57. logging: false,
  58. database: {{#if isSQLjs}}new Uint8Array([]){{else if isSQLite}}path.join(__dirname, '../vendure.sqlite'){{else}}'{{{ escapeSingle dbName }}}'{{/if}},
  59. {{#if isSQLjs}}
  60. location: path.join(__dirname, 'vendure.sqlite'),
  61. autoSave: true,
  62. {{/if}}
  63. {{#if requiresConnection}}
  64. host: '{{ dbHost }}',
  65. port: {{ dbPort }},
  66. username: '{{{ escapeSingle dbUserName }}}',
  67. password: '{{{ escapeSingle dbPassword }}}',
  68. {{/if}}
  69. migrations: [path.join(__dirname, '../migrations/*.ts')],
  70. },
  71. paymentOptions: {
  72. paymentMethodHandlers: [dummyPaymentHandler],
  73. },
  74. customFields: {},
  75. plugins: [
  76. AssetServerPlugin.init({
  77. route: 'assets',
  78. assetUploadDir: path.join(__dirname, '../static/assets'),
  79. }),
  80. DefaultJobQueuePlugin.init({ useDatabaseForBuffer: true }),
  81. DefaultSearchPlugin.init({ bufferUpdates: false, indexStockStatus: true }),
  82. EmailPlugin.init({
  83. devMode: true,
  84. outputPath: path.join(__dirname, '../static/email/test-emails'),
  85. route: 'mailbox',
  86. handlers: defaultEmailHandlers,
  87. templatePath: path.join(__dirname, '../static/email/templates'),
  88. globalTemplateVars: {
  89. // The following variables will change depending on your storefront implementation
  90. fromAddress: '"example" <noreply@example.com>',
  91. verifyEmailAddressUrl: 'http://localhost:8080/verify',
  92. passwordResetUrl: 'http://localhost:8080/password-reset',
  93. changeEmailAddressUrl: 'http://localhost:8080/verify-email-address-change'
  94. },
  95. }),
  96. AdminUiPlugin.init({
  97. route: 'admin',
  98. port: 3002,
  99. }),
  100. ],
  101. };
  102. {{#if isTs}}
  103. {{else}}
  104. module.exports = { config };
  105. {{/if}}