I try to deploy Scala-based KafkaClient inside a docker compose network. Problem is that if I hardcode JAAS-config in application.conf like this:
client-config {
bootstrap.servers = ${bootstrap.servers}
schema.registry.url = ${schema.registry.url}
security.protocol=SASL_PLAINTEXT
sasl.mechanism = "PLAIN"
sasl.jaas.config = """
org.apache.kafka.common.security.plain.PlainLoginModule required
username = 'kafka'
password = 'pwd';
"""
}
It works correctly. But if I use 'include' inside application.conf like this:
include "/opt/kafka_creds/jaas.conf"
jaas.conf:
JAAS_CONF = """
org.apache.kafka.common.security.plain.PlainLoginModule required
username = 'kafka'
password = 'pwd';
"""
I've got this kind of error:
Caused by: java.lang.IllegalArgumentException: Login module control flag is not available in the JAAS config
I also tried to add jaas configuration via environment, but it didn't work. My docker-compose.yml looks like:
version: '3'
services:
service_name:
image: adoptopenjdk/openjdk11:latest
hostname: service_name
container_name: service_name
volumes:
- ./build/distributions-fat/app-0.1.jar:/app-0.1.jar
- ./projects/:/opt/projects/
- /opt/kafka_creds/kafka_client_jaas.conf:/opt/kafka_client_jaas.conf
- /opt/kafka_creds/jaas.conf:/opt/kafka_creds/jaas.conf
networks:
- network_name
command: ["java", "-jar", "-Djava.security.auth.login.config=KafkaClient:/opt/kafka_client_jaas.conf", "app-0.1.jar"]
networks:
network_name:
name: network_name