Browse Source

chore: Add admin to medusa-config

olivermrbl 2 năm trước cách đây
mục cha
commit
9fb3a6cd9f
3 tập tin đã thay đổi với 1057 bổ sung44 xóa
  1. 27 39
      medusa-config.js
  2. 1 0
      package.json
  3. 1029 5
      yarn.lock

+ 27 - 39
medusa-config.js

@@ -1,57 +1,45 @@
-const dotenv = require('dotenv')
+const dotenv = require("dotenv");
 
-let ENV_FILE_NAME = '';
+let ENV_FILE_NAME = "";
 switch (process.env.NODE_ENV) {
-	case 'production':
-		ENV_FILE_NAME = '.env.production';
-		break;
-	case 'staging':
-		ENV_FILE_NAME = '.env.staging';
-		break;
-	case 'test':
-		ENV_FILE_NAME = '.env.test';
-		break;
-	case 'development':
-	default:
-		ENV_FILE_NAME = '.env';
-		break;
+  case "production":
+    ENV_FILE_NAME = ".env.production";
+    break;
+  case "staging":
+    ENV_FILE_NAME = ".env.staging";
+    break;
+  case "test":
+    ENV_FILE_NAME = ".env.test";
+    break;
+  case "development":
+  default:
+    ENV_FILE_NAME = ".env";
+    break;
 }
 
 try {
-	dotenv.config({ path: process.cwd() + '/' + ENV_FILE_NAME });
-} catch (e) {
-}
+  dotenv.config({ path: process.cwd() + "/" + ENV_FILE_NAME });
+} catch (e) {}
 
 // CORS when consuming Medusa from admin
-const ADMIN_CORS = process.env.ADMIN_CORS || "http://localhost:7000,http://localhost:7001";
+const ADMIN_CORS =
+  process.env.ADMIN_CORS || "http://localhost:7000,http://localhost:7001";
 
 // CORS to avoid issues when consuming Medusa from a client
 const STORE_CORS = process.env.STORE_CORS || "http://localhost:8000";
 
-// Database URL (here we use a local database called medusa-development)
-const DATABASE_URL =
-  process.env.DATABASE_URL || "postgres://localhost/medusa-store";
-
-// Medusa uses Redis, so this needs configuration as well
-const REDIS_URL = process.env.REDIS_URL || "redis://localhost:6379";
-
-// Stripe keys
-const STRIPE_API_KEY = process.env.STRIPE_API_KEY || "";
-const STRIPE_WEBHOOK_SECRET = process.env.STRIPE_WEBHOOK_SECRET || "";
-
 // This is the place to include plugins. See API documentation for a thorough guide on plugins.
 const plugins = [
   `medusa-fulfillment-manual`,
   `medusa-payment-manual`,
-  // Uncomment to add Stripe support.
-  // You can create a Stripe account via: https://stripe.com
-  // {
-  //   resolve: `medusa-payment-stripe`,
-  //   options: {
-  //     api_key: STRIPE_API_KEY,
-  //     webhook_secret: STRIPE_WEBHOOK_SECRET,
-  //   },
-  // },
+  {
+    resolve: "@medusajs/admin",
+    /** @type {import('@medusajs/admin').PluginOptions} */
+    options: {
+      path: "app",
+      outDir: "admin-build",
+    },
+  },
 ];
 /** @type {import('@medusajs/medusa').ConfigModule} */
 module.exports = {

+ 1 - 0
package.json

@@ -10,6 +10,7 @@
     "start": "medusa develop"
   },
   "dependencies": {
+    "@medusajs/admin": "^0.0.0",
     "@medusajs/medusa": "^1.6.0",
     "@medusajs/medusa-cli": "^1.3.3",
     "medusa-fulfillment-manual": "^1.1.31",

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1029 - 5
yarn.lock


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác