spring:
  application:
    name: auth-service
  profiles:
    active: ${SPRING_PROFILES_ACTIVE:dev}

  cloud:
    consul:
      host: ${CONSUL_HOST:localhost}
      port: ${CONSUL_PORT:8500}
      enabled: ${CONSUL_ENABLED:true}
      discovery:
        enabled: ${CONSUL_ENABLED:true}
        register: ${CONSUL_ENABLED:true}
        health-check-path: /actuator/health
        health-check-interval: 10s
        instance-id: ${spring.application.name}-${server.port}-${random.uuid}

  security:
    oauth2:
      resourceserver:
        jwt:
          # This will be configured via environment variables in production
          jwk-set-uri: ${KEYCLOAK_JWK_SET_URI:http://localhost:8180/realms/meldestelle/protocol/openid-connect/certs}

server:
  port: ${AUTH_SERVICE_PORT:8087}

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
      base-path: /actuator
      cors:
        allowed-origins:
          - "https://*.meldestelle.at"
          - "http://localhost:*"
        allowed-methods: GET,POST
        allowed-headers: "*"
        allow-credentials: true
  endpoint:
    health:
      show-details: always
      show-components: always
      probes:
        enabled: true
    metrics:
      enabled: true
    prometheus:
      enabled: true
  metrics:
    tags:
      application: ${spring.application.name}
      environment: ${spring.profiles.active}
      service: auth
      component: infrastructure
  # Tracing-Konfiguration
  tracing:
    enabled: ${TRACING_ENABLED:false}
    sampling:
      probability: ${TRACING_SAMPLING_PROBABILITY:1.0}
  zipkin:
    tracing:
      endpoint: ${ZIPKIN_TRACING_ENDPOINT:http://localhost:9411/api/v2/spans}
      connect-timeout: 1s
      read-timeout: 10s

logging:
  level:
    at.mocode.infrastructure.auth: DEBUG
    org.springframework.security: DEBUG
    org.springframework.cloud.consul: INFO

# Custom properties can be added here when proper @ConfigurationProperties classes are created
# For now, these properties are moved to environment variables or removed to avoid warnings
