vendure-config.hbs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. migrations: [path.join(__dirname, '../migrations/*.ts')],
  53. },
  54. paymentOptions: {
  55. paymentMethodHandlers: [examplePaymentHandler],
  56. },
  57. customFields: {},
  58. plugins: [
  59. AssetServerPlugin.init({
  60. route: 'assets',
  61. assetUploadDir: path.join(__dirname, '../static/assets'),
  62. port: 3001,
  63. }),
  64. DefaultSearchPlugin,
  65. EmailPlugin.init({
  66. devMode: true,
  67. outputPath: path.join(__dirname, '../static/email/test-emails'),
  68. mailboxPort: 3003,
  69. handlers: defaultEmailHandlers,
  70. templatePath: path.join(__dirname, '../static/email/templates'),
  71. globalTemplateVars: {
  72. // The following variables will change depending on your storefront implementation
  73. fromAddress: '"example" <noreply@example.com>',
  74. verifyEmailAddressUrl: 'http://localhost:8080/verify',
  75. passwordResetUrl: 'http://localhost:8080/password-reset',
  76. changeEmailAddressUrl: 'http://localhost:8080/verify-email-address-change'
  77. },
  78. }),
  79. AdminUiPlugin.init({ port: 3002 }),
  80. ],
  81. };
  82. {{#if isTs}}
  83. {{else}}
  84. module.exports = { config };
  85. {{/if}}