application.yml
3.2 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
spring:
application:
name: user-service
profiles:
active: production
datasource:
url: jdbc:postgresql://postgresql-service:5432/ecommerce_users
username: ${SPRING_DATASOURCE_USERNAME:admin}
password: ${SPRING_DATASOURCE_PASSWORD}
driver-class-name: org.postgresql.Driver
hikari:
maximum-pool-size: 10
minimum-idle: 2
connection-timeout: 30000
idle-timeout: 600000
max-lifetime: 1800000
jpa:
hibernate:
ddl-auto: validate
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
show-sql: false
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
jdbc:
batch_size: 20
order_inserts: true
order_updates: true
redis:
host: redis-service
port: 6379
password: ${SPRING_REDIS_PASSWORD}
timeout: 2000
lettuce:
pool:
max-active: 10
max-idle: 5
min-idle: 2
max-wait: 1000
# ==================== Flyway 数据库迁移配置 ====================
flyway:
enabled: true
validate-on-migrate: true
baseline-on-migrate: true
baseline-version: 1
locations: classpath:db/migration
schemas: public
table: flyway_schema_history
clean-disabled: true
out-of-order: false
ignore-missing-migrations: false
ignore-future-migrations: true
# 如果数据库不存在时自动创建(可选)
# create-schemas: true
# 初始化SQL(可选)
# init-sqls: CREATE SCHEMA IF NOT EXISTS public;
server:
port: 8080
servlet:
context-path: /api
eureka:
client:
enabled: false
register-with-eureka: false
fetch-registry: false
management:
endpoints:
web:
exposure:
include: health,info,metrics,prometheus
enabled-by-default: false
endpoint:
health:
enabled: true
show-details: always
probes:
enabled: true
info:
enabled: true
metrics:
enabled: true
prometheus:
enabled: true
health:
db:
enabled: true
redis:
enabled: true
# Flyway 健康检查
flyway:
enabled: true
logging:
level:
com.ecommerce.user: DEBUG
org.hibernate.SQL: WARN
org.hibernate.type.descriptor.sql.BasicBinder: WARN
org.springframework.security: WARN
# Flyway 日志配置
org.flywaydb: INFO
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
jwt:
secret: ${JWT_SECRET}
expiration: ${JWT_EXPIRATION:86400000}
refresh-expiration: 2592000000
app:
security:
password:
min-length: ${PASSWORD_MIN_LENGTH:8}
max-length: ${PASSWORD_MAX_LENGTH:128}
login:
max-attempts: ${MAX_LOGIN_ATTEMPTS:5}
lockout-duration: ${ACCOUNT_LOCKOUT_DURATION:900000}
verification:
email: ${REQUIRE_EMAIL_VERIFICATION:true}
phone: ${REQUIRE_PHONE_VERIFICATION:false}
bcrypt-strength: ${BCRYPT_STRENGTH:12}
session-timeout: ${SESSION_TIMEOUT:1800}
csrf-protection: ${ENABLE_CSRF_PROTECTION:true}
notification:
service-url: ${NOTIFICATION_SERVICE_URL:http://notification-service:8080}
send-welcome-email: ${SEND_WELCOME_EMAIL:true}