generated from medusajs/medusa-starter-default
-
Notifications
You must be signed in to change notification settings - Fork 0
/
medusa-config.js
71 lines (62 loc) · 2.05 KB
/
medusa-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const dotenv = require('dotenv')
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;
}
try {
dotenv.config({ path: process.cwd() + '/' + ENV_FILE_NAME });
} catch (e) {
}
// CORS when consuming Medusa from admin
const ADMIN_CORS = process.env.ADMIN_CORS || "https://chic-madeleine-4b766e.netlify.app";
// CORS to avoid issues when consuming Medusa from a client
const STORE_CORS = process.env.STORE_CORS || "https://main--taupe-lollipop-df09d2.netlify.app/";
// Database URL (here we use a local database called medusa-development)
const DATABASE_URL =
process.env.DATABASE_URL || "postgres://yqpkvehswylfoi:055ebb88441181a46825be1b71c125efaa8fda9447596e8510a4cb1318d59df3@ec2-3-230-122-20.compute-1.amazonaws.com:5432/d867vgiasg2lj0";
// 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,
// },
// },
];
module.exports = {
projectConfig: {
// redis_url: REDIS_URL,
// For more production-like environment install PostgresQL
database_url: DATABASE_URL,
database_type: "postgres",
store_cors: STORE_CORS,
admin_cors: ADMIN_CORS,
database_extra:
process.env.NODE_ENV !== "development"
? { ssl: { rejectUnauthorized: false } }
: {},
},
plugins,
};