mirror of
https://github.com/samanhappy/mcphub.git
synced 2026-01-03 05:10:09 -05:00
fix: rename DATABASE_URL to DB_URL for consistency across configurations (#545)
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -106,7 +106,7 @@ jobs:
|
|||||||
|
|
||||||
# - name: Run integration tests
|
# - name: Run integration tests
|
||||||
# run: |
|
# run: |
|
||||||
# export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/mcphub_test"
|
# export DB_URL="postgresql://postgres:postgres@localhost:5432/mcphub_test"
|
||||||
# node test-integration.ts
|
# node test-integration.ts
|
||||||
# env:
|
# env:
|
||||||
# NODE_ENV: test
|
# NODE_ENV: test
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ services:
|
|||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
- JWT_SECRET=${JWT_SECRET:-your-jwt-secret}
|
- JWT_SECRET=${JWT_SECRET:-your-jwt-secret}
|
||||||
- DATABASE_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
- DB_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
||||||
volumes:
|
volumes:
|
||||||
- ./mcp_settings.json:/app/mcp_settings.json:ro
|
- ./mcp_settings.json:/app/mcp_settings.json:ro
|
||||||
- ./servers.json:/app/servers.json:ro
|
- ./servers.json:/app/servers.json:ro
|
||||||
@@ -180,7 +180,7 @@ services:
|
|||||||
- PORT=3000
|
- PORT=3000
|
||||||
- JWT_SECRET=${JWT_SECRET}
|
- JWT_SECRET=${JWT_SECRET}
|
||||||
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-24h}
|
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-24h}
|
||||||
- DATABASE_URL=postgresql://mcphub:${POSTGRES_PASSWORD}@postgres:5432/mcphub
|
- DB_URL=postgresql://mcphub:${POSTGRES_PASSWORD}@postgres:5432/mcphub
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||||
- REDIS_URL=redis://redis:6379
|
- REDIS_URL=redis://redis:6379
|
||||||
volumes:
|
volumes:
|
||||||
@@ -293,7 +293,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
- DATABASE_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
- DB_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
- /app/node_modules
|
- /app/node_modules
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ PORT=3000
|
|||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
|
|
||||||
# Database Configuration
|
# Database Configuration
|
||||||
DATABASE_URL=postgresql://username:password@localhost:5432/mcphub
|
DB_URL=postgresql://username:password@localhost:5432/mcphub
|
||||||
|
|
||||||
# JWT Configuration
|
# JWT Configuration
|
||||||
JWT_SECRET=your-secret-key
|
JWT_SECRET=your-secret-key
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ Smart Routing requires additional setup compared to basic MCPHub usage:
|
|||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
- DATABASE_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
- DB_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
||||||
- OPENAI_API_KEY=your_openai_api_key
|
- OPENAI_API_KEY=your_openai_api_key
|
||||||
- ENABLE_SMART_ROUTING=true
|
- ENABLE_SMART_ROUTING=true
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -114,7 +114,7 @@ Smart Routing requires additional setup compared to basic MCPHub usage:
|
|||||||
|
|
||||||
2. **Set Environment Variables**:
|
2. **Set Environment Variables**:
|
||||||
```bash
|
```bash
|
||||||
export DATABASE_URL="postgresql://mcphub:your_password@localhost:5432/mcphub"
|
export DB_URL="postgresql://mcphub:your_password@localhost:5432/mcphub"
|
||||||
export OPENAI_API_KEY="your_openai_api_key"
|
export OPENAI_API_KEY="your_openai_api_key"
|
||||||
export ENABLE_SMART_ROUTING="true"
|
export ENABLE_SMART_ROUTING="true"
|
||||||
```
|
```
|
||||||
@@ -178,7 +178,7 @@ Smart Routing requires additional setup compared to basic MCPHub usage:
|
|||||||
- name: mcphub
|
- name: mcphub
|
||||||
image: samanhappy/mcphub:latest
|
image: samanhappy/mcphub:latest
|
||||||
env:
|
env:
|
||||||
- name: DATABASE_URL
|
- name: DB_URL
|
||||||
value: "postgresql://mcphub:password@postgres:5432/mcphub"
|
value: "postgresql://mcphub:password@postgres:5432/mcphub"
|
||||||
- name: OPENAI_API_KEY
|
- name: OPENAI_API_KEY
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@@ -202,7 +202,7 @@ Configure Smart Routing with these environment variables:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Required
|
# Required
|
||||||
DATABASE_URL=postgresql://user:password@host:5432/database
|
DB_URL=postgresql://user:password@host:5432/database
|
||||||
OPENAI_API_KEY=your_openai_api_key
|
OPENAI_API_KEY=your_openai_api_key
|
||||||
|
|
||||||
# Optional
|
# Optional
|
||||||
@@ -219,10 +219,10 @@ EMBEDDING_BATCH_SIZE=100
|
|||||||
<Accordion title="Database Configuration">
|
<Accordion title="Database Configuration">
|
||||||
```bash
|
```bash
|
||||||
# Full PostgreSQL connection string
|
# Full PostgreSQL connection string
|
||||||
DATABASE_URL=postgresql://username:password@host:port/database?schema=public
|
DB_URL=postgresql://username:password@host:port/database?schema=public
|
||||||
|
|
||||||
# SSL configuration for cloud databases
|
# SSL configuration for cloud databases
|
||||||
DATABASE_URL=postgresql://user:pass@host:5432/db?sslmode=require
|
DB_URL=postgresql://user:pass@host:5432/db?sslmode=require
|
||||||
|
|
||||||
# Connection pool settings
|
# Connection pool settings
|
||||||
DATABASE_POOL_SIZE=20
|
DATABASE_POOL_SIZE=20
|
||||||
@@ -673,11 +673,11 @@ curl -X POST http://localhost:3000/api/smart-routing/feedback \
|
|||||||
|
|
||||||
**Solutions:**
|
**Solutions:**
|
||||||
1. Verify PostgreSQL is running
|
1. Verify PostgreSQL is running
|
||||||
2. Check DATABASE_URL format
|
2. Check DB_URL format
|
||||||
3. Ensure pgvector extension is installed
|
3. Ensure pgvector extension is installed
|
||||||
4. Test connection manually:
|
4. Test connection manually:
|
||||||
```bash
|
```bash
|
||||||
psql $DATABASE_URL -c "SELECT 1;"
|
psql $DB_URL -c "SELECT 1;"
|
||||||
```
|
```
|
||||||
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ Set the following environment variables:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Database connection
|
# Database connection
|
||||||
DATABASE_URL=postgresql://mcphub:your_password@localhost:5432/mcphub
|
DB_URL=postgresql://mcphub:your_password@localhost:5432/mcphub
|
||||||
|
|
||||||
# OpenAI API for embeddings
|
# OpenAI API for embeddings
|
||||||
OPENAI_API_KEY=your_openai_api_key
|
OPENAI_API_KEY=your_openai_api_key
|
||||||
@@ -563,10 +563,10 @@ curl -X POST http://localhost:3000/mcp \
|
|||||||
**Database connection failed:**
|
**Database connection failed:**
|
||||||
```bash
|
```bash
|
||||||
# Test database connection
|
# Test database connection
|
||||||
psql $DATABASE_URL -c "SELECT 1;"
|
psql $DB_URL -c "SELECT 1;"
|
||||||
|
|
||||||
# Check if pgvector is installed
|
# Check if pgvector is installed
|
||||||
psql $DATABASE_URL -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
psql $DB_URL -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Embedding service errors:**
|
**Embedding service errors:**
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ services:
|
|||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
- JWT_SECRET=${JWT_SECRET:-your-jwt-secret}
|
- JWT_SECRET=${JWT_SECRET:-your-jwt-secret}
|
||||||
- DATABASE_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
- DB_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
||||||
volumes:
|
volumes:
|
||||||
- ./mcp_settings.json:/app/mcp_settings.json:ro
|
- ./mcp_settings.json:/app/mcp_settings.json:ro
|
||||||
- ./servers.json:/app/servers.json:ro
|
- ./servers.json:/app/servers.json:ro
|
||||||
@@ -180,7 +180,7 @@ services:
|
|||||||
- PORT=3000
|
- PORT=3000
|
||||||
- JWT_SECRET=${JWT_SECRET}
|
- JWT_SECRET=${JWT_SECRET}
|
||||||
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-24h}
|
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-24h}
|
||||||
- DATABASE_URL=postgresql://mcphub:${POSTGRES_PASSWORD}@postgres:5432/mcphub
|
- DB_URL=postgresql://mcphub:${POSTGRES_PASSWORD}@postgres:5432/mcphub
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||||
- REDIS_URL=redis://redis:6379
|
- REDIS_URL=redis://redis:6379
|
||||||
volumes:
|
volumes:
|
||||||
@@ -293,7 +293,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
- DATABASE_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
- DB_URL=postgresql://mcphub:password@postgres:5432/mcphub
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
- /app/node_modules
|
- /app/node_modules
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ MCPHub 支持使用 `${VAR_NAME}` 语法进行环境变量替换:
|
|||||||
"command": "python",
|
"command": "python",
|
||||||
"args": ["-m", "db_server"],
|
"args": ["-m", "db_server"],
|
||||||
"env": {
|
"env": {
|
||||||
"DB_URL": "${NODE_ENV:development == 'production' ? DATABASE_URL : DEV_DATABASE_URL}"
|
"DB_URL": "${NODE_ENV:development == 'production' ? DB_URL : DEV_DB_URL}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ PORT=3000
|
|||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
|
|
||||||
# 数据库配置
|
# 数据库配置
|
||||||
DATABASE_URL=postgresql://username:password@localhost:5432/mcphub
|
DB_URL=postgresql://username:password@localhost:5432/mcphub
|
||||||
|
|
||||||
# JWT 配置
|
# JWT 配置
|
||||||
JWT_SECRET=your-secret-key
|
JWT_SECRET=your-secret-key
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ docker run -d \
|
|||||||
--name mcphub \
|
--name mcphub \
|
||||||
-p 3000:3000 \
|
-p 3000:3000 \
|
||||||
-e NODE_ENV=production \
|
-e NODE_ENV=production \
|
||||||
-e DATABASE_URL=postgresql://user:pass@host:5432/mcphub \
|
-e DB_URL=postgresql://user:pass@host:5432/mcphub \
|
||||||
-e JWT_SECRET=your-secret-key \
|
-e JWT_SECRET=your-secret-key \
|
||||||
mcphub/server:latest
|
mcphub/server:latest
|
||||||
|
|
||||||
@@ -504,7 +504,7 @@ docker run -d \
|
|||||||
--name mcphub \
|
--name mcphub \
|
||||||
-p 3000:3000 \
|
-p 3000:3000 \
|
||||||
-e NODE_ENV=production \
|
-e NODE_ENV=production \
|
||||||
-e DATABASE_URL=postgresql://user:pass@host:5432/mcphub \
|
-e DB_URL=postgresql://user:pass@host:5432/mcphub \
|
||||||
-e JWT_SECRET=your-secret-key \
|
-e JWT_SECRET=your-secret-key \
|
||||||
mcphub/server:latest
|
mcphub/server:latest
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ services:
|
|||||||
- '3000:3000'
|
- '3000:3000'
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- DATABASE_URL=postgresql://user:pass@db:5432/mcphub
|
- DB_URL=postgresql://user:pass@db:5432/mcphub
|
||||||
```
|
```
|
||||||
````
|
````
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ services:
|
|||||||
- '3000:3000'
|
- '3000:3000'
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- DATABASE_URL=postgresql://user:pass@db:5432/mcphub
|
- DB_URL=postgresql://user:pass@db:5432/mcphub
|
||||||
```
|
```
|
||||||
|
|
||||||
### 终端命令
|
### 终端命令
|
||||||
|
|||||||
@@ -245,11 +245,11 @@ curl -X POST http://localhost:3000/api/smart-routing/feedback \
|
|||||||
|
|
||||||
**解决方案:**
|
**解决方案:**
|
||||||
1. 验证 PostgreSQL 是否正在运行
|
1. 验证 PostgreSQL 是否正在运行
|
||||||
2. 检查 DATABASE_URL 格式
|
2. 检查 DB_URL 格式
|
||||||
3. 确保安装了 pgvector 扩展
|
3. 确保安装了 pgvector 扩展
|
||||||
4. 手动测试连接:
|
4. 手动测试连接:
|
||||||
```bash
|
```bash
|
||||||
psql $DATABASE_URL -c "SELECT 1;"
|
psql $DB_URL -c "SELECT 1;"
|
||||||
```
|
```
|
||||||
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ description: '各种平台的详细安装说明'
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 数据库连接
|
# 数据库连接
|
||||||
DATABASE_URL=postgresql://mcphub:your_password@localhost:5432/mcphub
|
DB_URL=postgresql://mcphub:your_password@localhost:5432/mcphub
|
||||||
|
|
||||||
# 用于嵌入的 OpenAI API
|
# 用于嵌入的 OpenAI API
|
||||||
OPENAI_API_KEY=your_openai_api_key
|
OPENAI_API_KEY=your_openai_api_key
|
||||||
@@ -538,10 +538,10 @@ curl -X POST http://localhost:3000/mcp \
|
|||||||
**数据库连接失败:**
|
**数据库连接失败:**
|
||||||
```bash
|
```bash
|
||||||
# 测试数据库连接
|
# 测试数据库连接
|
||||||
psql $DATABASE_URL -c "SELECT 1;"
|
psql $DB_URL -c "SELECT 1;"
|
||||||
|
|
||||||
# 检查是否安装了 pgvector
|
# 检查是否安装了 pgvector
|
||||||
psql $DATABASE_URL -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
psql $DB_URL -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
||||||
```
|
```
|
||||||
|
|
||||||
**嵌入服务错误:**
|
**嵌入服务错误:**
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"API_KEY": "${MY_API_KEY}",
|
"API_KEY": "${MY_API_KEY}",
|
||||||
"DEBUG": "${DEBUG_MODE}",
|
"DEBUG": "${DEBUG_MODE}",
|
||||||
"DATABASE_URL": "${DATABASE_URL}"
|
"DB_URL": "${DB_URL}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"example-stdio-with-proxy": {
|
"example-stdio-with-proxy": {
|
||||||
@@ -96,7 +96,10 @@
|
|||||||
"clientId": "${OAUTH_CLIENT_ID}",
|
"clientId": "${OAUTH_CLIENT_ID}",
|
||||||
"clientSecret": "${OAUTH_CLIENT_SECRET}",
|
"clientSecret": "${OAUTH_CLIENT_SECRET}",
|
||||||
"accessToken": "${OAUTH_ACCESS_TOKEN}",
|
"accessToken": "${OAUTH_ACCESS_TOKEN}",
|
||||||
"scopes": ["read", "write"]
|
"scopes": [
|
||||||
|
"read",
|
||||||
|
"write"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -118,4 +121,4 @@
|
|||||||
"baseUrl": "${MCPROUTER_BASE_URL}"
|
"baseUrl": "${MCPROUTER_BASE_URL}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ export interface SmartRoutingConfig {
|
|||||||
*
|
*
|
||||||
* Priority order for each setting:
|
* Priority order for each setting:
|
||||||
* 1. Specific environment variables (ENABLE_SMART_ROUTING, SMART_ROUTING_ENABLED, etc.)
|
* 1. Specific environment variables (ENABLE_SMART_ROUTING, SMART_ROUTING_ENABLED, etc.)
|
||||||
* 2. Generic environment variables (OPENAI_API_KEY, DATABASE_URL, etc.)
|
* 2. Generic environment variables (OPENAI_API_KEY, DB_URL, etc.)
|
||||||
* 3. Settings configuration (systemConfig.smartRouting)
|
* 3. Settings configuration (systemConfig.smartRouting)
|
||||||
* 4. Default values
|
* 4. Default values
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'reflect-metadata';
|
|||||||
Object.assign(process.env, {
|
Object.assign(process.env, {
|
||||||
NODE_ENV: 'test',
|
NODE_ENV: 'test',
|
||||||
JWT_SECRET: 'test-jwt-secret-key',
|
JWT_SECRET: 'test-jwt-secret-key',
|
||||||
DATABASE_URL: 'sqlite::memory:',
|
DB_URL: 'sqlite::memory:',
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mock moduleDir to avoid import.meta parsing issues in Jest
|
// Mock moduleDir to avoid import.meta parsing issues in Jest
|
||||||
@@ -40,7 +40,7 @@ expect.extend({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toBeValidUUID(received: any) {
|
toBeValidUUID(received: any) {
|
||||||
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
||||||
const pass = typeof received === 'string' && uuidRegex.test(received);
|
const pass = typeof received === 'string' && uuidRegex.test(received);
|
||||||
|
|||||||
Reference in New Issue
Block a user