<%#
 Copyright 2013-2019 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

      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.
-%>
version: '<%= DOCKER_COMPOSE_FORMAT_VERSION %>'
services:
    jhipster-registry:
        image: <%= DOCKER_JHIPSTER_REGISTRY %>
        volumes:
            - ./central-server-config:/central-config
        # By default the JHipster Registry runs with the "dev" and "native"
        # Spring profiles.
        # "native" profile means the filesystem is used to store data, see
        # http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html
        environment:
            - _JAVA_OPTIONS=-Xmx512m -Xms256m
            - SPRING_PROFILES_ACTIVE=dev<% if (authenticationType === 'oauth2') { %>,oauth2<% } %><% if (authenticationType === 'uaa') { %>,uaa<% } %>
            - SPRING_SECURITY_USER_PASSWORD=<%= adminPassword %>
            - JHIPSTER_REGISTRY_PASSWORD=<%= adminPassword %>
            - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native
            - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config
            # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=git
            # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI=https://github.com/jhipster/jhipster-registry/
            # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_PATHS=central-config
            <%_ if (monitoring === 'elk') { _%>
            - JHIPSTER_LOGGING_LOGSTASH_ENABLED=true
            - JHIPSTER_LOGGING_LOGSTASH_HOST=jhipster-logstash
            - JHIPSTER_METRICS_LOGS_ENABLED=true
            - JHIPSTER_METRICS_LOGS_REPORTFREQUENCY=60
            <%_ } _%>
            <%_ if (monitoring === 'prometheus') { _%>
            - JHIPSTER_METRICS_PROMETHEUS_ENABLED=true
            - JHIPSTER_METRICS_PROMETHEUS_ENDPOINT=/prometheusMetrics
            <%_ } _%>
            <%_ if (authenticationType === 'oauth2') { _%>
            # For Keycloak to work, you need to add '127.0.0.1 keycloak' to your hosts file
            - SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI=http://keycloak:9080/auth/realms/jhipster/protocol/openid-connect/token
            - SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI=http://keycloak:9080/auth/realms/jhipster/protocol/openid-connect/auth
            - SECURITY_OAUTH2_CLIENT_CLIENT_ID=jhipster-registry
            - SECURITY_OAUTH2_CLIENT_CLIENT_SECRET=jhipster-registry
            - SECURITY_OAUTH2_RESOURCE_USER_INFO_URI=http://keycloak:9080/auth/realms/jhipster/protocol/openid-connect/userinfo
            <%_ } _%>
            <%_ if (authenticationType === 'uaa') { _%>
            # change the name of UAA server here, if needed
            - JHIPSTER_SECURITY_CLIENT_AUTHORIZATION_TOKEN_SERVICE_ID=uaa
            <%_ } _%>
        ports:
            - 8761:8761
