vendure-config.hbs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {{#if isTs }}import{{ else }}const{{/if}} {
  2. examplePaymentHandler,
  3. DefaultSearchPlugin,{{#if isTs}}
  4. VendureConfig,{{/if}}
  5. } {{#if isTs}}from '@vendure/core'; {{ else }}= require('@vendure/core');{{/if}}
  6. {{#if isTs }}
  7. import { defaultEmailHandlers, EmailPlugin } from '@vendure/email-plugin';
  8. {{ else }}
  9. const { defaultEmailHandlers, EmailPlugin } = require('@vendure/email-plugin');
  10. {{/if}}
  11. {{#if isTs }}
  12. import { AssetServerPlugin } from '@vendure/asset-server-plugin';
  13. {{ else }}
  14. const { AssetServerPlugin } = require('@vendure/asset-server-plugin');
  15. {{/if}}
  16. {{#if isTs }}
  17. import { AdminUiPlugin } from '@vendure/admin-ui-plugin';
  18. {{ else }}
  19. const { AdminUiPlugin } = require('@vendure/admin-ui-plugin');
  20. {{/if}}
  21. {{#if isTs }}
  22. import path from 'path';
  23. {{ else }}
  24. const path = require('path');
  25. {{/if}}
  26. {{#if isTs}}export {{/if}}const config{{#if isTs}}: VendureConfig{{/if}} = {
  27. authOptions: {
  28. sessionSecret: '{{ sessionSecret }}',
  29. },
  30. port: 3000,
  31. adminApiPath: 'admin-api',
  32. shopApiPath: 'shop-api',
  33. dbConnectionOptions: {
  34. type: '{{ dbType }}',
  35. {{#if requiresConnection}}
  36. synchronize: true, // turn this off for production
  37. {{else}}
  38. synchronize: false, // not working with SQLite/SQL.js, see https://github.com/typeorm/typeorm/issues/2576
  39. {{/if}}
  40. logging: false,
  41. database: {{#if isSQLjs}}new Uint8Array([]){{else if isSQLite}}path.join(__dirname, 'vendure.sqlite'){{else}}'{{ dbName }}'{{/if}},
  42. {{#if isSQLjs}}
  43. location: path.join(__dirname, 'vendure.sqlite'),
  44. autoSave: true,
  45. {{/if}}
  46. {{#if requiresConnection}}
  47. host: '{{ dbHost }}',
  48. port: {{ dbPort }},
  49. username: '{{ dbUserName }}',
  50. password: '{{ dbPassword }}',
  51. {{/if}}
  52. },
  53. paymentOptions: {
  54. paymentMethodHandlers: [examplePaymentHandler],
  55. },
  56. customFields: {},
  57. plugins: [
  58. new AssetServerPlugin({
  59. route: 'assets',
  60. assetUploadDir: path.join(__dirname, 'vendure/assets'),
  61. port: 3001,
  62. }),
  63. new EmailPlugin({
  64. devMode: true,
  65. outputPath: path.join(__dirname, 'vendure/email/test-emails'),
  66. mailboxPort: 3003,
  67. handlers: defaultEmailHandlers,
  68. templatePath: path.join(__dirname, 'vendure/email/templates'),
  69. globalTemplateVars: {
  70. // The following variables will change depending on your storefront implementation
  71. verifyEmailAddressUrl: 'http://localhost:8080/verify',
  72. passwordResetUrl: 'http://localhost:8080/password-reset',
  73. changeEmailAddressUrl: 'http://localhost:8080/verify-email-address-change'
  74. },
  75. }),
  76. new DefaultSearchPlugin(),
  77. new AdminUiPlugin({ port: 3002 }),
  78. ],
  79. };
  80. {{#if isTs}}
  81. {{else}}
  82. module.exports = { config };
  83. {{/if}}