<%#
 Copyright 2013-2017 the original author or authors from the JBooter project.

 This file is part of the JBooter project, see https://jbooter.github.io/
 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

      http://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://jbooter.github.io/profiles/
# More information on configuration properties: https://jbooter.github.io/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
# ===================================================================

<%_ if (serviceDiscoveryType == 'eureka') { _%>
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 %>
        instanceId: <%= baseName %>:${spring.application.instance-id:${random.value}}
        lease-renewal-interval-in-seconds: 5
        lease-expiration-duration-in-seconds: 10
        status-page-url-path: ${management.context-path}/info
        health-check-url-path: ${management.context-path}/health
        metadata-map:
            zone: primary # This is needed for the load balancer
            profile: ${spring.profiles.active}
            version: ${info.project.version}
ribbon:
    eureka:
        enabled: true
<%_ } _%>
<%_ if (applicationType === 'gateway') { _%>
# See http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html
zuul: # those values must be configured depending on the application specific needs
    host:
        max-total-connections: 1000
        max-per-route-connections: 100
    semaphore:
        max-semaphores: 500
    <%_ if (serviceDiscoveryType == 'consul') { _%>
    ignoredServices: 'consul,<%= baseName %>' # Prevent Consul and the "<%= baseName %>" app itself from having a Zuul route automatically created for them
    <%_ } _%>

# See https://github.com/Netflix/Hystrix/wiki/Configuration
hystrix:
    command:
        default:
            execution:
                isolation:
                    thread:
                        timeoutInMilliseconds: 10000

<%_ } _%>
<%_ if (applicationType === 'microservice') { _%>
# See https://github.com/Netflix/Hystrix/wiki/Configuration
#hystrix:
#    command:
#        default:
#            execution:
#                isolation:
#                    thread:
#                        timeoutInMilliseconds: 10000

<%_ } _%>
management:
    security:
        roles: ADMIN
    context-path: /management
    health:
        mail:
            enabled: false # When using the MailService, configure an SMTP server and set this to true
<%_ if (messageBroker == 'kafka') { _%>
        binders:
            enabled: true
<%_ } _%>
spring:
    application:
        name: <%= baseName %>
    <%_ if (serviceDiscoveryType == 'consul') { _%>
    cloud:
        consul:
            discovery:
                healthCheckPath: /management/health
                instanceId: ${spring.application.name}:${spring.application.instance-id:${random.value}}
    <%_ } _%>
    <%_ if (applicationType === 'monolith') { _%>
    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 WAR 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#
    <%_ } _%>
    jackson:
        serialization.write_dates_as_timestamps: false
    <%_ if (databaseType == 'sql') { _%>
    jpa:
        open-in-view: false
        hibernate:
            ddl-auto: none
            naming:
                physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
                implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
    <%_ } _%>
    messages:
        basename: i18n/messages
    mvc:
        favicon:
            enabled: false
    thymeleaf:
        mode: XHTML
<%_ if (enableSocialSignIn) { _%>
    social:
        # see https://developers.google.com/+/web/signin/server-side-flow#step_1_create_a_client_id_and_client_secret
        google:
            client-id: xxx
            client-secret: xxx

        # see https://developers.facebook.com/docs/facebook-login/v2.2
        facebook:
            client-id: xxx
            client-secret: xxx

        # see https://apps.twitter.com/app/
        twitter:
            client-id: xxx
            client-secret: xxx

        # jbooter-needle-add-social-configuration
<%_ } _%>

security:
    basic:
        enabled: false
    <%_ if (authenticationType == 'oauth2' || authenticationType == 'uaa') { _%>
    oauth2:
        resource:
            filter-order: 3
    <%_ } _%>

server:
    session:
        cookie:
            http-only: true

<%_ if (serviceDiscoveryType === false) { _%>
info:
    project:
        version: #project.version#
<%_ } _%>

# ===================================================================
# JBooter specific properties
#
# Full reference is available at: https://jbooter.github.io/common-application-properties/
# ===================================================================

jbooter:
    async:
        core-pool-size: 2
        max-pool-size: 50
        queue-capacity: 10000
    # By default CORS is disabled. Uncomment to enable.
    #cors:
        #allowed-origins: "*"
        #allowed-methods: GET, PUT, POST, DELETE, OPTIONS
        #allowed-headers: "*"
        #exposed-headers:
        #allow-credentials: true
        #max-age: 1800
    mail:
        from: <%= baseName %>@localhost
    swagger:
        default-include-pattern: /api/.*
        title: <%=baseName%> API
        description: <%=baseName%> API documentation
        version: 0.0.1
        terms-of-service-url:
        contact-name:
        contact-url:
        contact-email:
        license:
        license-url:
<%_ if (enableSocialSignIn) { _%>
    social:
        <%_ if (authenticationType == 'jwt') { _%>
        redirect-after-sign-in: "/#/social-auth"
        <%_ } else { _%>
        redirect-after-sign-in: "/#/"
        <%_ } _%>
<%_ } _%>
    ribbon:
        display-on-active-profiles: dev

# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
# to have type-safe configuration, like in the JBooterProperties above
#
# More documentation is available at:
# https://jbooter.github.io/common-application-properties/
# ===================================================================

application:
