application.yml
3.47 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
132
133
134
135
136
137
138
139
spring:
  application:
    name: notification-service
  profiles:
    active: production
  datasource:
    url: jdbc:postgresql://postgresql-service.ecommerce.svc.cluster.local:5432/ecommerce_notifications
    username: ${DB_USERNAME:postgres}
    password: ${DB_PASSWORD:password}
    driver-class-name: org.postgresql.Driver
  jpa:
    hibernate:
      ddl-auto: validate
    properties:
      hibernate:
        dialect: org.hibernate.dialect.PostgreSQLDialect
        show_sql: false
        format_sql: true
        jdbc:
          lob:
            non_contextual_creation: true
  # Flyway 数据库迁移配置
  flyway:
    enabled: true
    locations: classpath:db/migration
    baseline-on-migrate: true
    validate-on-migrate: true
    clean-disabled: true
    # 生产环境特定配置
    out-of-order: false
    ignore-missing-migrations: false
    ignore-ignored-migrations: false
    ignore-pending-migrations: false
    # 表名配置
    table: flyway_schema_history
    # 连接配置
    connect-retries: 3
    init-sqls: SET TIME ZONE 'UTC'
  # 异步任务配置
  task:
    execution:
      pool:
        core-size: 5
        max-size: 20
        queue-capacity: 100
      thread-name-prefix: notification-async-
  mail:
    host: ${SMTP_HOST:smtp.gmail.com}
    port: ${SMTP_PORT:587}
    username: ${SMTP_USERNAME:your-email@gmail.com}
    password: ${SMTP_PASSWORD:your-app-password}
    properties:
      mail:
        smtp:
          auth: true
          starttls:
            enable: true
        transport:
          protocol: smtp
        debug: false
  rabbitmq:
    host: rabbitmq.ecommerce.svc.cluster.local
    port: 5672
    username: ${RABBITMQ_USERNAME:guest}
    password: ${RABBITMQ_PASSWORD:guest}
    virtual-host: /
    connection-timeout: 5000
server:
  port: 8080
  servlet:
    context-path: /api
eureka:
  client:
    service-url:
      defaultZone: http://service-registry:8761/eureka/
    register-with-eureka: true
    fetch-registry: true
# SMS Configuration
sms:
  provider: ${SMS_PROVIDER:twilio} # twilio, aws_sns, simulation
  twilio:
    account-sid: ${TWILIO_ACCOUNT_SID:default-sid}
    auth-token: ${TWILIO_AUTH_TOKEN:default-token}
    phone-number: ${TWILIO_PHONE_NUMBER:+1234567890}
  aws:
    sns:
      region: ${AWS_SNS_REGION:us-east-1}
# FCM Configuration
fcm:
  server-key: ${FCM_SERVER_KEY:default-key}
  url: ${FCM_URL:https://fcm.googleapis.com/fcm/send}
  service-account-file: ${FCM_SERVICE_ACCOUNT_FILE:firebase-service-account.json}
  database-url: ${FCM_DATABASE_URL:https://your-project-id.firebaseio.com}
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
  endpoint:
    health:
      show-details: always
      show-components: always
      # 添加 Flyway 健康检查
      group:
        db:
          include: db,flyway
logging:
  level:
    com.ecommerce.notification: INFO
    org.springframework.amqp: WARN
    org.hibernate.SQL: WARN
    org.springframework.mail: WARN
    org.flywaydb: INFO  # 添加 Flyway 日志级别
    org.springframework.scheduling: INFO  # 添加异步任务日志级别
  pattern:
    console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
springdoc:
  api-docs:
    path: /v3/api-docs
  swagger-ui:
    path: /swagger-ui.html
    operations-sorter: method
# Scheduled tasks for processing pending notifications
scheduling:
  enabled: true
# 缓存配置(如果使用缓存)
cache:
  type: simple
  caffeine:
    spec: maximumSize=1000,expireAfterWrite=3600s