<%#
 Copyright 2013-2023 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      https://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-%>
# ===================================================================
# Spring Boot configuration.
#
# This configuration will be overridden by the Spring profile you use,
# for example application-dev.yml if you use the "dev" profile.
#
# More information on profiles: https://www.jhipster.tech/profiles/
# More information on configuration properties: https://www.jhipster.tech/common-application-properties/
# ===================================================================

# ===================================================================
# Standard Spring Boot properties.
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================

---
# Conditionally disable springdoc on missing api-docs profile
spring:
  config:
    activate:
      on-profile: '!api-docs'
springdoc:
  api-docs:
    enabled: false
---

<%_ if (serviceDiscoveryEureka) { _%>
eureka:
  client:
    enabled: true
    healthcheck:
      enabled: true
    fetch-registry: true
    register-with-eureka: true
    instance-info-replication-interval-seconds: 10
    registry-fetch-interval-seconds: 10
  instance:
    appname: <%= baseName.toLowerCase() %>
    instanceId: <%= baseName.toLowerCase() %>:${spring.application.instance-id:${random.value}}
    lease-renewal-interval-in-seconds: 5
    lease-expiration-duration-in-seconds: 10
    status-page-url-path: ${management.endpoints.web.base-path}/info
    health-check-url-path: ${management.endpoints.web.base-path}/health
    metadata-map:
      zone: primary # This is needed for the load balancer
      profile: ${spring.profiles.active}
      version: #project.version#
      git-version: ${git.commit.id.describe:}
      git-commit: ${git.commit.id.abbrev:}
      git-branch: ${git.branch:}
      context-path: ${server.servlet.context-path:}
<%_ } _%>
<%_ if (applicationTypeGateway || (applicationTypeMicroservice && reactive)) { _%>
reactive:
  feign:
    circuit:
      breaker:
        enabled: true
  # client:
  #   config:
  #     default:
  #       connectTimeout: 5000
  #       readTimeout: 5000
<%_ } _%>
<%_ if (applicationTypeMicroservice && !reactive) { _%>
feign:
  circuitbreaker:
    enabled: true
  # client:
  #   config:
  #     default:
  #       connectTimeout: 5000
  #       readTimeout: 5000
<%_ } _%>
management:
  endpoints:
    web:
      base-path: /management
      exposure:
        include:
          - configprops
          - env
<% if (applicationTypeGateway && reactive) { -%>
          - gateway
<% } -%>
          - health
          - info
          - jhimetrics
          - jhiopenapigroups
          - logfile
          - loggers
          - prometheus
          - threaddump
<% if (cacheProviderAny) { -%>
          - caches
<% } -%>
<% if (databaseMigrationLiquibase) { -%>
          - liquibase
<% } -%>
  endpoint:
    health:
      show-details: when_authorized
      roles: "ROLE_ADMIN"
      probes:
        enabled: true
      group:
        liveness:
          include: livenessState
        readiness:
          include: readinessState<% if (databaseTypeSql && !reactive) { %>,db<% } %>
    jhimetrics:
      enabled: true
  info:
    git:
      mode: full
    env:
      enabled: true
  health:
    mail:
      enabled: false # When using the MailService, configure an SMTP server and set this to true
  prometheus:
    metrics:
      export:
        enabled: true
        step: 60
    enable:
      http: true
      jvm: true
      logback: true
      process: true
      system: true
    distribution:
      percentiles-histogram:
        all: true
      percentiles:
        all: 0, 0.5, 0.75, 0.95, 0.99, 1.0
    tags:
      application: ${spring.application.name}
    web:
      server:
        request:
          autotime:
            enabled: true

<%_ if (databaseTypeMongodb) { _%>
mongock:
  migration-scan-package:
    - <%= packageName %>.config.dbmigrations

<%_ } _%>
spring:
<%_ if (databaseTypeSql && messageBrokerKafka) { _%>
  autoconfigure:
    exclude: org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration
<%_ } _%>
  application:
    name: <%= baseName %>
<%_ if (workflow === 'camunda') { _%><%# add by begcode %>
  jersey:
    application-path: /workflow/rest
<%_ } _%>
<%_ if (serviceDiscoveryConsul || (applicationTypeGateway && reactive) || messageBrokerKafka) { _%>
  cloud:
  <%_ if (serviceDiscoveryConsul) { _%>
    consul:
      discovery:
        healthCheckPath: /management/health
        instanceId: <%= baseName.toLowerCase() %>:${spring.application.instance-id:${random.value}}
        service-name: <%= baseName.toLowerCase() %>
      config:
        watch:
          enabled: false
  <%_ } _%>
  <%_ if (applicationTypeGateway && reactive) { _%>
    gateway:
      default-filters:
        - <% if (authenticationTypeJwt) { %>JWTRelay<% } else { %>TokenRelay<% } %>
      discovery:
        locator:
          enabled: true
          lower-case-service-id: true
          predicates:
            - name: Path
              args:
                pattern: "'/services/'+serviceId.toLowerCase()+'/**'"
          filters:
            - name: RewritePath
              args:
                regexp: "'/services/' + serviceId.toLowerCase() + '/(?<remaining>.*)'"
                replacement: "'/${remaining}'"
      httpclient:
        pool:
          max-connections: 1000
  <%_ } _%>
  <%_ if (messageBrokerKafka) { _%>
    function:
      definition: kafkaConsumer;kafkaProducer
    stream:
      kafka:
        binder:
          replicationFactor: 1
          auto-create-topics: true
          brokers: localhost:9092
      bindings:
        binding-out-0:
          content-type: text/plain
          group: <%= dasherizedBaseName %>
        kafkaConsumer-in-0:
          destination: sse-topic
          content-type: text/plain
          group: <%= dasherizedBaseName %>
        kafkaProducer-out-0:
          content-type: text/plain
          group: <%= dasherizedBaseName %>
  <%_ } _%>
<%_ } _%>
  profiles:
    # The commented value for `active` can be replaced with valid Spring profiles to load.
    # Otherwise, it will be filled in by <%= buildTool %> when building the JAR file
    # Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS`
    active: #spring.profiles.active#
    group:
      dev:
        - dev
        - api-docs
        # Uncomment to activate TLS for the dev profile
        #- tls
  jmx:
    enabled: false
<%_ if (databaseTypeSql && !reactive && ormTool === 'hibernate') { _%>
  data:
    jpa:
      repositories:
        bootstrap-mode: deferred
  jpa:
    open-in-view: false
    properties:
      hibernate.jdbc.time_zone: UTC
      hibernate.timezone.default_storage: NORMALIZE
      hibernate.type.preferred_instant_jdbc_type: TIMESTAMP
      hibernate.id.new_generator_mappings: true
      hibernate.connection.provider_disables_autocommit: true
      hibernate.cache.use_second_level_cache: <% if (enableHibernateCache) { %>true<% } else { %>false<% } %>
      hibernate.cache.use_query_cache: false
      hibernate.generate_statistics: false
      # modify batch size as necessary
      hibernate.jdbc.batch_size: 25
      hibernate.order_inserts: true
      hibernate.order_updates: true
  <%_ if (prodDatabaseTypeMssql || prodDatabaseTypeOracle) { _%>
      # modify fetch size as necessary
      hibernate.jdbc.fetch_size: 150
      hibernate.criteria.literal_handling_mode: BIND
  <%_ } _%>
      hibernate.query.fail_on_pagination_over_collection_fetch: true
      hibernate.query.in_clause_parameter_padding: true
  <%_ if (enableHibernateCache) { _%>
    <%_ if (cacheProviderHazelcast) { _%>
      hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory
      hibernate.cache.use_minimal_puts: true
      hibernate.cache.hazelcast.instance_name: <%= baseName %>
      hibernate.cache.hazelcast.use_lite_member: true
    <%_ } else if (cacheProviderInfinispan) { _%>
      hibernate.cache.infinispan.statistics: false
      hibernate.cache.use_minimal_puts: true
      hibernate.cache.infinispan.entity.expiration.lifespan: 3600000
      hibernate.cache.infinispan.entity.memory.size: 1000
      hibernate.cache.infinispan.jgroups_cfg: default-configs/default-jgroups-tcp.xml
    <%_ } _%>
  <%_ } _%>
    hibernate:
      ddl-auto: none
      naming:
        physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
        implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
<%_ } _%>
  messages:
    basename: i18n/messages
  main:
    allow-bean-definition-overriding: true
  <% if (reactive) { %>webflux<% } else { %>mvc<% } %>:
    problemdetails:
      enabled: true
<%_ if (generateInMemoryUserCredentials) { _%>
  security:
    user:
      name: admin
      password: admin
      roles:
        - ADMIN
        - USER
<%_ } _%>
  task:
    execution:
      thread-name-prefix: <%= dasherizedBaseName %>-task-
      pool:
        core-size: 2
        max-size: 50
        queue-capacity: 10000
    scheduling:
      thread-name-prefix: <%= dasherizedBaseName %>-scheduling-
      pool:
        size: 2
  thymeleaf:
    mode: HTML
  output:
    ansi:
      console-available: true
<%# add by begcode start _%>
  servlet:
    multipart:
      max-file-size: 10MB
      max-request-size: 10MB
  web:
    resources:
      static-locations: classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath:/public/, file:data/
<%# add by begcode end _%>
<%_ if (authenticationTypeOauth2) { _%>
  security:
    oauth2:
      client:
        provider:
          oidc:
            issuer-uri: http://localhost:9080/realms/jhipster
        registration:
          oidc:
  <%_ if (applicationTypeMicroservice) { _%>
            client-id: internal
            client-secret: internal
  <%_ } else { _%>
            client-id: web_app
            client-secret: web_app
  <%_ } _%>
            scope: openid, profile, email, offline_access # last one for refresh tokens
<%_ } _%>

server:
  servlet:
    session:
      cookie:
        http-only: true

springdoc:
  show-actuator: true

# Properties to be exposed on the /info management endpoint
info:
  # Comma separated list of profiles that will trigger the ribbon to show
  display-ribbon-on-profiles: "dev"

# ===================================================================
# JHipster specific properties
#
# Full reference is available at: https://www.jhipster.tech/common-application-properties/
# ===================================================================

jhipster:
  clientApp:
    name: "<%= frontendAppName %>"
  # By default CORS is disabled. Uncomment to enable.
  # cors:
  #   allowed-origins: "http://localhost:8100,http://localhost:9000"
  #   allowed-methods: "*"
  #   allowed-headers: "*"
<%_ if (authenticationTypeSession) { _%>
  #   exposed-headers: "Link,X-Total-Count,X-${jhipster.clientApp.name}-alert,X-${jhipster.clientApp.name}-error,X-${jhipster.clientApp.name}-params"
<%_ } else { _%>
  #   exposed-headers: "Authorization,Link,X-Total-Count,X-${jhipster.clientApp.name}-alert,X-${jhipster.clientApp.name}-error,X-${jhipster.clientApp.name}-params"
<%_ } _%>
  #   allow-credentials: true
  #   max-age: 1800
  mail:
    from: <%= baseName %>@localhost
  api-docs:
    default-include-pattern: /api/**
    management-include-pattern: /management/**
    title: <%= humanizedBaseName %> API
    description: <%= humanizedBaseName %> API documentation
    version: 0.0.1
    terms-of-service-url:
    contact-name:
    contact-url:
    contact-email:
    license: unlicensed
    license-url:
  security:
<%_ if(!skipClient) { _%>
    <%_ if (clientTheme !== 'none') { _%>
    content-security-policy: "default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' https://fonts.googleapis.com 'unsafe-inline'; img-src 'self' data:; font-src 'self' https://fonts.gstatic.com data:"
    <%_ } else { _%>
    content-security-policy: "default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:"
    <%_ } _%>
<%_ } _%>
<%_ if (authenticationTypeOauth2) { _%>
    oauth2:
      audience:
        - account
        - api://default
<%_ } _%>

# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
# to have type-safe configuration, like in the JHipsterProperties above
#
# More documentation is available at:
# https://www.jhipster.tech/common-application-properties/
# ===================================================================
<%# add by begcode start _%>
application:
  upload:
    root-path: data
    domainUrl: /
    type: local
<%_ if (ossProvider === 'local') { _%>
  oss:
    name: local
    enabled: true
    endpoint: /
    bucketName: data
<%_ } else if (ossProvider === 'minio') { _%>
  oss:
    name: minio
    enabled: true
    endpoint: http://127.0.0.1:9800
    bucketName: data
    accessKey: xxxx
    secretKey: xxxx
<%_ } else if (ossProvider === 'ali') { _%>
  oss:
    name: ali
    enabled: true
    endpoint: /
    bucketName: data
    accessKey: xxxx
    secretKey: xxxx
<%_ } else if (ossProvider === 'tencent') { _%>
  oss:
    name: tencent
    enabled: true
    endpoint: /
    bucketName: data
    appId: xxxx
    region: xxxx
    accessKey: xxxx
    secretKey: xxxx
<%_ } else if (ossProvider === 'qiniu') { _%>
  oss:
    name: qiniu
    enabled: true
    endpoint: /
    bucketName: data
    accessKey: xxxx
    secretKey: xxxx
<%_ } _%>
<%_ if (smsProvider === 'ali') { _%>
  sms:
    name: ali
    enabled: true
    templateId: xxxx
    regionId: data
    accessKey: xxxx
    secretKey: xxxx
    signName: xxxx
<%_ } else if (smsProvider === 'tencent') { _%>
  sms:
    name: tencent
    enabled: true
    templateId: xxxx
    regionId: data
    accessKey: xxxx
    secretKey: xxxx
    signName: xxxx
<%_ } else if (smsProvider === 'qiniu') { _%>
  sms:
    name: qiniu
    enabled: true
    templateId: xxxx
    regionId: data
    accessKey: xxxx
    secretKey: xxxx
    signName: xxxx
<%_ } else if (smsProvider === 'yunpian') { _%>
  sms:
    name: yunpian
    enabled: true
    templateId: xxxx
    regionId: data
    accessKey: xxxx
    secretKey: xxxx
    signName: xxxx
<%_ } _%>
  pay:
    wxPay:
      appId: xxxxxxx #微信公众号或者小程序等的appid
      mchId: xxxx #微信支付商户号
      mchKey: xxxxx #微信支付商户密钥
      subAppId: #服务商模式下的子商户公众账号ID
      subMchId: #服务商模式下的子商户号
      keyPath: classpath:config/cert/apiclient_cert.p12 # p12证书的位置，可以指定绝对路径，也可以指定类路径（以classpath:开头）
  face:
    arcFace:
      appId: CHuRTesMsVrfR6pZwyQt7JMkB7BSR4P5QsBxneQvsNzR
      sdkKey: 3osgFgkF7ygzEuYnTTW99iUvks844N85f5j9Cgn6SKqm
oauth:
  qq:
    client-id: 1015*****
    client-secret: 1f7d08df55766**************
    redirect-uri: http://oauth.xkcoding.com/demo/oauth/qq/callback
  github:
    client-id: 2d25a70**************
    client-secret: 5a2919b5fe911567343**************
    redirect-uri: http://oauth.xkcoding.com/demo/oauth/github/callback
  wechat:
    client-id: wxdcb31**************
    client-secret: b4e9dc6841ef7d**************
    redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat/callback
  google:
    client-id: 716518501517-6dbdkapivhia806vqcjjh9nttj3**************
    client-secret: 9IBornd7w1A**************
    redirect-uri: http://oauth.xkcoding.com/demo/oauth/google/callback
  microsoft:
    client-id: 7bdce818-2c8e-4b**************
    client-secret: Iu0zZ43RQydo_FkD**************
    redirect-uri: https://oauth.xkcoding.com/demo/oauth/microsoft/callback
  mi:
    client-id: 2882303**************
    client-secret: nFeTt89Yn**************
    redirect-uri: http://oauth.xkcoding.com/demo/oauth/mi/callback
<%_ if (ormTool === 'mybatis') { _%>
mybatis-plus:
  config-location: classpath:/config/mybatis-config.xml
  global-config:
    db-config:
  <%_ if (softDelete) { _%>
      logic-delete-field: delFlag
      logic-delete-value: 1
      logic-not-delete-value: 0
  <%_ } _%>
      insert-strategy: ignored
      update-strategy: ignored
<%_ } _%>
<%_ if (workflow === 'flowable') { _%>
flowable:
  font-name: 宋体
<%_ } _%>
<%# add by begcode end _%>
