
server:
  port: 8000
  ssl:
    enabled: true
    key-alias: baeldung
    key-store-password: 1q2w3e4r!
    key-store: classpath:baeldung.p12
    key-store-type: PKCS12

eureka:
  client:
    fetch-registry: true
    register-with-eureka: true
    service-url:
      defalutZone: http://localhost:8761/eureka

spring:
  application:
    name: customer-apigateway-service
  config:
    import: optional:configserver:http://127.0.0.1:8888
  cloud:
    config:
      name: bootstrap
    gateway:
      default-filters:
        - name: GlobalFilter
          args:
            baseMessage: Spring Cloud Gateway Global Filter
            preLogger: true
            postLogger: true
      globalcors:
        cors-configurations:
          '[/**]':
            allowedOrigins: "https://just-pickup.com:8080"
            allowedMethods:
              - GET
              - POST
              - DELETE
              - PUT
              - OPTIONS
              - DELETE
              - PATCH
            allowedHeaders: '*'
            allow-credentials: true
      routes:
        - id: order-service
          uri: lb://ORDER-SERVICE
          predicates:
            - Path=/order-service/**
          filters:
            - AuthorizationHeaderFilter
            - RewritePath=/order-service/(?<segment>.*),/$\{segment}

        - id: store-service
          uri: lb://STORE-SERVICE
          predicates:
            - Path=/store-service/**
          filters:
            - AuthorizationHeaderFilter
            - RewritePath=/store-service/(?<segment>.*),/$\{segment}

        - id: notification-service
          uri: lb://NOTIFICATION-SERVICE
          predicates:
            - Path=/notification-service/**
          filters:
            - AuthorizationHeaderFilter
            - RewritePath=/notification-service/(?<segment>.*),/$\{segment}

        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/login
            - Method=POST
          filters:
            - RewritePath=/user-service/(?<segment>.*),/$\{segment}
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/reissue
            - Method=GET
          filters:
            - RewritePath=/user-service/(?<segment>.*),/$\{segment}
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/logout
            - Method=POST
          filters:
            - RewritePath=/user-service/(?<segment>.*),/$\{segment}
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/auth/reissue
            - Method=GET
          filters:
            - RewritePath=/user-service/(?<segment>.*),/$\{segment}
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/oauth2/authorization/*
          filters:
            - RewritePath=/user-service/(?<segment>.*),/$\{segment}
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/*/oauth2/code/*
          filters:
            - RewritePath=/user-service/(?<segment>.*),/$\{segment}
        - id: user-service
          uri: lb://USER-SERVICE
          predicates:
            - Path=/user-service/**
          filters:
            - AuthorizationHeaderFilter
            - RewritePath=/user-service/(?<segment>.*),/$\{segment}

token:
  access-expired-time: 3600000
  refresh-expired-time: 604800000
  secret: $2a$10$q42lY7Y18xqrFt1qbODZIO4OMTeOxnrCe7tF3n9bazJinVE7VH5Pi
  refresh-token-name: refresh-token
  access-token-name: access-token