You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
928 B
32 lines
928 B
import dotenv from 'dotenv';
|
|
|
|
dotenv.config();
|
|
|
|
export const config = {
|
|
port: process.env.PORT || 3005,
|
|
jwtSecret: process.env.JWT_SECRET || 'your-secret-key',
|
|
database: {
|
|
mongo: {
|
|
url: process.env.MONGO_URL || 'mongodb://localhost:27017/alpha-futures'
|
|
},
|
|
postgres: {
|
|
host: process.env.PG_HOST || 'localhost',
|
|
port: parseInt(process.env.PG_PORT || '5432'),
|
|
user: process.env.PG_USER || 'postgres',
|
|
password: process.env.PG_PASSWORD || 'password',
|
|
database: process.env.PG_DATABASE || 'alpha-futures'
|
|
}
|
|
},
|
|
redis: {
|
|
url: process.env.REDIS_URL || 'redis://localhost:6379'
|
|
},
|
|
rateLimit: {
|
|
windowMs: 60 * 1000, // 1分钟
|
|
max: 120 // 每分钟120次请求
|
|
},
|
|
cors: {
|
|
origin: '*', // 在生产环境中应该设置具体的域名
|
|
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
|
allowedHeaders: ['Content-Type', 'Authorization']
|
|
}
|
|
}; |