# ===================================================================
# Spring Boot configuration.
#
# This configuration is used for unit/integration tests.
# ===================================================================

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

<%_ if (applicationType == 'microservice' || applicationType == 'gateway' || applicationType == 'uaa') { _%>
eureka:
    client:
        enabled: false
    instance:
        appname: <%= baseName %>
        instanceId: <%= baseName %>:${spring.application.instance_id:${random.value}}

<%_ } _%>
spring:
    application:
        name: <%= baseName %>
    <%_ if (applicationType == 'gateway' && databaseType != 'cassandra') { _%>
    autoconfigure:
        exclude: org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration, org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration
    <%_ } _%>
    jackson:
        serialization.write_dates_as_timestamps: false
    <%_ if (databaseType == 'sql') { _%>
    datasource:
        url: jdbc:h2:mem:<%= baseName %>;DB_CLOSE_DELAY=-1
        name:
        username:
        password:
    jpa:
        database-platform: <%=packageName%>.domain.util.FixedH2Dialect
        database: H2
        open-in-view: false
        show-sql: true
        hibernate:
            ddl-auto: none
            naming-strategy: org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy
        properties:
            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 (applicationType == 'gateway' || databaseType == 'cassandra') { _%>
        cassandra:
            contactPoints: localhost
            port: 9142
            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: target/elasticsearch/log
                  data: target/elasticsearch/data
    <%_ } _%>
    mail:
        host: localhost
    mvc:
        favicon:
            enabled: false
    thymeleaf:
        mode: XHTML

liquibase:
    contexts: test

security:
    basic:
        enabled: false

server:
    port: 10344
    address: localhost

# ===================================================================
# JHGenesis specific properties
# ===================================================================

jh-genesis:
    async:
        corePoolSize: 2
        maxPoolSize: 50
        queueCapacity: 10000
<%_ if (authenticationType == 'oauth2' || authenticationType == 'jwt' || authenticationType == 'uaa') { _%>
    security:
        authentication:
    <%_ if (authenticationType == 'jwt' || authenticationType == 'uaa') { _%>
            jwt:
                secret: <%= jwtSecretKey %>
                # Token is valid 24 hours
                tokenValidityInSeconds: 86400
    <%_ } _%>
    <%_ if (authenticationType == 'oauth2') { _%>
            oauth:
                clientid: <%= baseName %>app
                secret: my-secret-token-to-change-in-production
                # Token is valid 30 minutes
                tokenValidityInSeconds: 1800
    <%_ } _%>
<%_ } _%>
<%_ if (authenticationType == 'session') { _%>
    security:
        rememberMe:
            # 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
    swagger:
        title: <%=baseName%> API
        description: <%=baseName%> API documentation
        version: 0.0.1
        termsOfServiceUrl:
        contactName:
        contactUrl:
        contactEmail:
        license:
        licenseUrl:
