application.yml 2.87 KB
spring:
  application:
    name: payment-service
  profiles:
    active: prod
  datasource:
    url: jdbc:postgresql://postgresql-service.ecommerce.svc.cluster.local:5432/ecommerce_payments
    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
    # 表名配置
    table: flyway_schema_history
    # 迁移时占位符替换
    placeholders:
      app-name: payment-service
    # 迁移失败时的行为
    ignore-migration-patterns: '*:pending'
    # 在迁移前验证迁移文件
    validate-migration-naming: true
    # 迁移时是否允许混合事务性和非事务性语句
    mixed: true
    # 迁移时是否允许重复的迁移文件
    ignore-ignored-migrations: true
    # 迁移时是否忽略缺失的迁移文件
    ignore-missing-migrations: true
  rabbitmq:
    host: rabbitmq-service.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 服务发现
eureka:
  client:
    enabled: false
    register-with-eureka: false
    fetch-registry: false

feign:
  client:
    config:
      default:
        connectTimeout: 5000
        readTimeout: 10000
        loggerLevel: basic
  circuitbreaker:
    enabled: false  # 如果不需要断路器也可以禁用

# Stripe Configuration
stripe:
  secret-key: ${STRIPE_SECRET_KEY:sk_test_default}
  publishable-key: ${STRIPE_PUBLISHABLE_KEY:pk_test_default}
  webhook-secret: ${STRIPE_WEBHOOK_SECRET:whsec_default}

# PayPal Configuration
paypal:
  client-id: ${PAYPAL_CLIENT_ID:default-client-id}
  client-secret: ${PAYPAL_CLIENT_SECRET:default-client-secret}
  mode: ${PAYPAL_MODE:sandbox}

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
  endpoint:
    health:
      show-details: always
      show-components: always
    # Flyway 健康检查
    flyway:
      enabled: true

logging:
  level:
    com.ecommerce.payment: INFO
    org.springframework.amqp: WARN
    org.hibernate.SQL: WARN
    feign: DEBUG
    com.stripe: WARN
    # Flyway 日志配置
    org.flywaydb: INFO
    org.flywaydb.core: 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