Files
happy-life-star/packages/emotion-museum-1.0.0-20250713_111829/backend/config/application-test.yml
T

206 lines
4.5 KiB
YAML

# 情绪博物馆测试环境配置
# 适用于测试环境部署,使用IP访问,不使用域名
server:
port: 9001
spring:
application:
name: emotion-user
profiles:
active: test
cloud:
nacos:
discovery:
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
namespace: emotion-test
group: TEST_GROUP
enabled: true
ip: ${SERVER_IP:localhost}
port: ${server.port}
metadata:
version: 1.0.0
environment: test
config:
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
file-extension: yml
namespace: emotion-test
group: TEST_GROUP
enabled: true
refresh-enabled: true
datasource:
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/emotion_museum?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${MYSQL_USERNAME:emotion}
password: ${MYSQL_PASSWORD:emotion123}
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
pool-name: EmotionUserTestHikariCP
minimum-idle: 3
maximum-pool-size: 15
auto-commit: true
idle-timeout: 30000
max-lifetime: 1800000
connection-timeout: 30000
connection-test-query: SELECT 1
data:
redis:
host: ${REDIS_HOST:localhost}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD:}
database: 1
timeout: 6000ms
lettuce:
pool:
max-active: 8
max-wait: -1ms
max-idle: 8
min-idle: 2
# MyBatis Plus配置
mybatis-plus:
configuration:
map-underscore-to-camel-case: true
cache-enabled: true
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
global-config:
db-config:
id-type: assign_uuid
logic-delete-field: is_deleted
logic-delete-value: 1
logic-not-delete-value: 0
banner: false
mapper-locations: classpath*:mapper/**/*.xml
# 日志配置
logging:
level:
root: INFO
com.emotionmuseum: INFO
com.emotionmuseum.user.mapper: DEBUG
org.springframework.cloud.gateway: INFO
org.springframework.web: INFO
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}] - %msg%n"
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}] - %msg%n"
file:
name: /data/logs/emotion-museum/user-service.log
max-size: 100MB
max-history: 30
# 管理端点
management:
endpoints:
web:
exposure:
include: health,info,metrics,prometheus,env,configprops
base-path: /actuator
endpoint:
health:
show-details: always
show-components: always
metrics:
export:
prometheus:
enabled: true
health:
redis:
enabled: true
db:
enabled: true
# JWT配置
jwt:
secret: ${JWT_SECRET:emotion-museum-test-secret-key-2025}
expiration: ${JWT_EXPIRATION:7200}
refresh-expiration: ${JWT_REFRESH_EXPIRATION:86400}
# COZE AI配置
coze:
api:
token: ${COZE_API_TOKEN:your-coze-api-token}
base-url: https://api.coze.cn
bot-id: 7523042446285439016
workflow-id: 7523047462895796287
timeout: 30000
retry-count: 3
# 跨域配置
cors:
allowed-origins:
- "http://localhost:3000"
- "http://localhost:8080"
- "http://${SERVER_IP:localhost}"
- "http://${SERVER_IP:localhost}:3000"
- "http://${SERVER_IP:localhost}:8080"
allowed-methods:
- GET
- POST
- PUT
- DELETE
- OPTIONS
allowed-headers:
- "*"
allow-credentials: true
max-age: 3600
# 文件上传配置
file:
upload:
path: /data/uploads/emotion-museum
max-size: 10MB
allowed-types:
- image/jpeg
- image/png
- image/gif
- image/webp
# 缓存配置
cache:
redis:
default-ttl: 3600
user-info-ttl: 1800
conversation-ttl: 7200
# 限流配置
rate-limit:
enabled: true
default-limit: 100
default-window: 60
api-limits:
"/api/auth/login": 10
"/api/auth/register": 5
"/api/ai/chat": 20
# 安全配置
security:
ignore-urls:
- /actuator/**
- /api/auth/login
- /api/auth/register
- /api/public/**
- /swagger-ui/**
- /v3/api-docs/**
# 监控告警配置
alert:
enabled: true
thresholds:
cpu-usage: 80
memory-usage: 85
disk-usage: 90
response-time: 2000
# 测试环境特殊配置
test:
debug:
enabled: true
log-requests: true
log-responses: false
mock:
enabled: false
data:
auto-init: true
sample-data: true