medusa-config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const dotenv = require('dotenv')
  2. let ENV_FILE_NAME = '';
  3. switch (process.env.NODE_ENV) {
  4. case 'production_like':
  5. ENV_FILE_NAME = '.env.production';
  6. break;
  7. case 'test':
  8. ENV_FILE_NAME = '.env.test';
  9. break;
  10. default:
  11. ENV_FILE_NAME = '.env';
  12. break;
  13. }
  14. dotenv.config({ path: process.cwd() + '/' + ENV_FILE_NAME });
  15. // CORS when consuming Medusa from admin
  16. const ADMIN_CORS = process.env.ADMIN_CORS || "http://localhost:7000,http://localhost:7001";
  17. // CORS to avoid issues when consuming Medusa from a client
  18. const STORE_CORS = process.env.STORE_CORS || "http://localhost:8000";
  19. // Database URL (here we use a local database called medusa-development)
  20. const DATABASE_URL =
  21. process.env.DATABASE_URL || "postgres://localhost/medusa-store";
  22. // Medusa uses Redis, so this needs configuration as well
  23. const REDIS_URL = process.env.REDIS_URL || "redis://localhost:6379";
  24. // Stripe keys
  25. const STRIPE_API_KEY = process.env.STRIPE_API_KEY || "";
  26. const STRIPE_WEBHOOK_SECRET = process.env.STRIPE_WEBHOOK_SECRET || "";
  27. // This is the place to include plugins. See API documentation for a thorough guide on plugins.
  28. const plugins = [
  29. `medusa-fulfillment-manual`,
  30. `medusa-payment-manual`,
  31. // Uncomment to add Stripe support.
  32. // You can create a Stripe account via: https://stripe.com
  33. // {
  34. // resolve: `medusa-payment-stripe`,
  35. // options: {
  36. // api_key: STRIPE_API_KEY,
  37. // webhook_secret: STRIPE_WEBHOOK_SECRET,
  38. // },
  39. // },
  40. ];
  41. module.exports = {
  42. projectConfig: {
  43. // redis_url: REDIS_URL,
  44. // For more production-like environment install PostgresQL
  45. // database_url: DATABASE_URL,
  46. // database_type: "postgres",
  47. database_database: "./medusa-db.sql",
  48. database_type: "sqlite",
  49. store_cors: STORE_CORS,
  50. admin_cors: ADMIN_CORS,
  51. },
  52. plugins,
  53. };