medusa-config.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const dotenv = require("dotenv");
  2. let ENV_FILE_NAME = "";
  3. switch (process.env.NODE_ENV) {
  4. case "production":
  5. ENV_FILE_NAME = ".env.production";
  6. break;
  7. case "staging":
  8. ENV_FILE_NAME = ".env.staging";
  9. break;
  10. case "test":
  11. ENV_FILE_NAME = ".env.test";
  12. break;
  13. case "development":
  14. default:
  15. ENV_FILE_NAME = ".env";
  16. break;
  17. }
  18. try {
  19. dotenv.config({ path: process.cwd() + "/" + ENV_FILE_NAME });
  20. } catch (e) {}
  21. // CORS when consuming Medusa from admin
  22. const ADMIN_CORS =
  23. process.env.ADMIN_CORS || "http://localhost:7000,http://localhost:7001";
  24. // CORS to avoid issues when consuming Medusa from a client
  25. const STORE_CORS = process.env.STORE_CORS || "http://localhost:8000";
  26. // Medusa uses Redis, so this needs configuration as well
  27. const REDIS_URL = process.env.REDIS_URL || "redis://localhost:6379";
  28. // This is the place to include plugins. See API documentation for a thorough guide on plugins.
  29. const plugins = [`medusa-fulfillment-manual`, `medusa-payment-manual`];
  30. module.exports = {
  31. projectConfig: {
  32. redis_url: REDIS_URL,
  33. database_database: "./medusa-db.sql",
  34. database_type: "sqlite",
  35. store_cors: STORE_CORS,
  36. admin_cors: ADMIN_CORS,
  37. },
  38. plugins,
  39. };