medusa-config.js 1.8 KB

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