<%#
 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 is used for unit/integration tests.
#
# 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
    instance:
        appname: <%= baseName %>
        instanceId: <%= baseName %>:${spring.application.instance-id:${random.value}}
<%_ } _%>

spring:
    application:
        name: <%= baseName %>
    jackson:
        serialization.write_dates_as_timestamps: false
    cache:
        type: none
    <%_ if (messageBroker == 'kafka') { _%>
    cloud:
        stream:
            kafka:
                binder:
                    brokers: localhost
                    zk-nodes: localhost
            bindings:
                output:
                    destination: topic-jbooter
    <%_ } _%>
    <%_ if (databaseType == 'sql') { _%>
    datasource:
        type: com.zaxxer.hikari.HikariDataSource
        url: jdbc:h2:mem:<%= baseName %>;DB_CLOSE_DELAY=-1
        name:
        username:
        password:
    jpa:
        database-platform: io.github.jbooter.domain.util.FixedH2Dialect
        database: H2
        open-in-view: false
        show-sql: false
        hibernate:
            ddl-auto: none
            naming:
                physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
                implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
        properties:
            hibernate.id.new_generator_mappings: true
            hibernate.cache.use_second_level_cache: false
            hibernate.cache.use_query_cache: false
            hibernate.generate_statistics: true
            hibernate.hbm2ddl.auto: validate
    <%_ } _%>
    <%_ if (databaseType == 'mongodb' || databaseType == 'cassandra' || applicationType == 'gateway' || searchEngine == 'elasticsearch') { _%>
    data:
    <%_ } _%>
    <%_ if (databaseType == 'mongodb') { _%>
        mongodb:
            host: localhost
            port: 27117
            database: <%= baseName %>
    <%_ } _%>
    <%_ if (databaseType === 'cassandra') { _%>
        cassandra:
            contactPoints: localhost
            port: 0
            protocolVersion: V4
            compression: NONE
            keyspaceName: cassandra_unit_keyspace
    <%_ if (applicationType == 'gateway') { _%>
            repositories:
                enabled: false
    <%_ } } _%>
    <%_ if (searchEngine == 'elasticsearch') { _%>
        elasticsearch:
            cluster-name:
            cluster-nodes:
            properties:
                path:
                    logs: <%= BUILD_DIR %>elasticsearch/log
                    data: <%= BUILD_DIR %>elasticsearch/data
    <%_ } _%>
    mail:
        host: localhost
    messages:
        basename: i18n/messages
    mvc:
        favicon:
            enabled: false
    thymeleaf:
        mode: XHTML

liquibase:
    contexts: test

security:
    basic:
        enabled: false

server:
    port: 10344
    address: localhost

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

jbooter:
    async:
        core-pool-size: 1
        max-pool-size: 50
        queue-capacity: 10000
    # To test logstash appender
    logging:
        logstash:
            enabled: true
            host: localhost
            port: 5000
            queue-size: 512
<%_ if (!skipUserManagement) { _%>
    mail:
        from: test@localhost
        base-url: http://127.0.0.1:8080
<%_ } _%>
<%_ if (authenticationType == 'oauth2' || authenticationType == 'jwt' || authenticationType == 'uaa') { _%>
    security:
        authentication:
    <%_ if (authenticationType == 'jwt' || authenticationType == 'uaa') { _%>
            jwt:
                secret: <%= jwtSecretKey %>
                # Token is valid 24 hours
                token-validity-in-seconds: 86400
    <%_ } _%>
    <%_ if ((applicationType === 'microservice' || applicationType === 'uaa') && authenticationType === 'uaa') { _%>
        client-authorization:
            <%_ if (applicationType !== 'uaa') { _%>
            access-token-uri: http://<%= uaaBaseName.toLowerCase() %>/oauth/token
            token-service-id: <%= uaaBaseName.toLowerCase() %>
            <%_ } _%>
            client-id: internal
            client-secret: internal
    <%_ } _%>
    <%_ if (authenticationType == 'oauth2') { _%>
            oauth:
                client-id: <%= baseName %>app
                client-secret: my-secret-token-to-change-in-production
                # Token is valid 30 minutes
                token-validity-in-seconds: 1800
    <%_ } _%>
<%_ } _%>
<%_ if (authenticationType == 'session') { _%>
    security:
        remember-me:
            # security key (this key should be unique for your application, and kept secret)
            key: <%= rememberMeKey %>
<%_ } _%>
    metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
        jmx.enabled: true
        logs: # Reports Dropwizard metrics in the logs
            enabled: true
            report-frequency: 60 # in seconds

# ===================================================================
# 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:
