feat(tests): add comprehensive unit, integration, and e2e tests for API and database functionality
- Implemented end-to-end tests for API health checks, performance, behavior, and documentation. - Created integration tests for database connection, CRUD operations, transactions, and connection pool management. - Developed unit tests for configuration loading, environment variable handling, validation, default values, and helper functions. - Established a test setup with environment management and basic usage examples for the testing framework.
This commit is contained in:
58
templates/project/.env.example.raw
Normal file
58
templates/project/.env.example.raw
Normal file
@@ -0,0 +1,58 @@
|
||||
# 应用配置
|
||||
APP_MODE=development
|
||||
APP_BASE_URI=http://localhost:8080
|
||||
|
||||
# HTTP 服务配置
|
||||
HTTP_PORT=8080
|
||||
HTTP_HOST=0.0.0.0
|
||||
|
||||
# 数据库配置
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_NAME={{.ProjectName}}
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=password
|
||||
DB_SSL_MODE=disable
|
||||
DB_MAX_CONNECTIONS=25
|
||||
DB_MAX_IDLE_CONNECTIONS=5
|
||||
DB_CONNECTION_LIFETIME=5m
|
||||
|
||||
# Redis 配置
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=
|
||||
REDIS_DB=0
|
||||
|
||||
# JWT 配置
|
||||
JWT_SECRET_KEY=your-secret-key-here
|
||||
JWT_EXPIRES_TIME=168h
|
||||
|
||||
# HashIDs 配置
|
||||
HASHIDS_SALT=your-salt-here
|
||||
|
||||
# 日志配置
|
||||
LOG_LEVEL=info
|
||||
LOG_FORMAT=json
|
||||
|
||||
# 文件上传配置
|
||||
UPLOAD_MAX_SIZE=10MB
|
||||
UPLOAD_PATH=./uploads
|
||||
|
||||
# 邮件配置
|
||||
SMTP_HOST=smtp.gmail.com
|
||||
SMTP_PORT=587
|
||||
SMTP_USER=
|
||||
SMTP_PASSWORD=
|
||||
|
||||
# 第三方服务配置
|
||||
REDIS_URL=redis://localhost:6379/0
|
||||
DATABASE_URL=postgres://postgres:password@localhost:5432/{{.ProjectName}}?sslmode=disable
|
||||
|
||||
# 开发配置
|
||||
ENABLE_SWAGGER=true
|
||||
ENABLE_CORS=true
|
||||
DEBUG_MODE=true
|
||||
|
||||
# 监控配置
|
||||
ENABLE_METRICS=false
|
||||
METRICS_PORT=9090
|
||||
Reference in New Issue
Block a user