application.yml
3.41 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-
  # RabbitMQ 配置
  rabbitmq:
    host: rabbitmq-service.ecommerce.svc.cluster.local
    port: 5672
    username: ${RABBITMQ_USERNAME:guest}
    password: ${RABBITMQ_PASSWORD:guest}
    virtual-host: /
    connection-timeout: 5000
  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
server:
  port: 8080
  servlet:
    context-path: /api
# 完全禁用 Eureka 客户端
eureka:
  client:
    enabled: false
    register-with-eureka: false
    fetch-registry: false
  instance:
    prefer-ip-address: false
# SMS Configuration
sms:
  provider: ${SMS_PROVIDER:twilio}
  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
      group:
        db:
          include: db,flyway
logging:
  level:
    com.ecommerce.notification: INFO
    org.springframework.amqp: WARN
    org.springframework.cloud: OFF  # 完全关闭 Spring Cloud 日志
    com.netflix: OFF  # 完全关闭 Netflix 日志
    org.hibernate.SQL: WARN
    org.springframework.mail: WARN
    org.flywaydb: INFO
    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