title: Spring Boot/Spring Kafka SSL Configuration by environment variables impossible
body: <p>I have a spring boot application which communicates with Kafka.</p>
  
  <p>I configure this application in production by injecting environment variables.</p>
  
  <p>For kafka, I can configure most things with environment variables - bootstrap servers, ssl truststore location, ssl truststore password, group id, topic, eg: </p>
  
  <pre><code>SPRING_KAFKA_SSL_TRUSTSTORE-LOCATION: "file:/opt/app/jks/totally_real_file.jks"
  SPRING_KAFKA_SSL_TRUSTSTORE-PASSWORD: "hunter2"
  </code></pre>
  
  <p>Because I can configure ssl keystore and password with environment variables, I would assume that I could configure the SSL Protocol and Security Protocol; eg:</p>
  
  <pre><code>SPRING_KAFKA_PROPERTIES_SECURITY_PROTOCOL: "SSL"
  SPRING_KAFKA_PROPERTIES_SSL_PROTOCOL: "SSL"
  </code></pre>
  
  <p>But, I would assume incorrectly, because when I set it there, a message appears:</p>
  
  <pre><code>The configuration 'SECURITY_PROTOCOL' was supplied but isn't a known config
  The configuration 'SSL_PROTOCOL' was supplied but isn't a known config
  </code></pre>
  
  <p>More messages appear!</p>
  
  <pre><code>Bootstrap broker one:9093 disconnected
  Bootstrap broker two:9093 disconnected
  Bootstrap broker more_than_two:9093 disconnected
  </code></pre>
  
  <p>This makes me sad. I search the internet. 
  I find links:</p>
  
  <p><a href="https://stackoverflow.com/questions/51200107/spring-kafka-ssl-setup-in-spring-boot-application-yml">Spring Kafka SSL setup in Spring boot application.yml</a></p>
  
  <p>This doesn't help much, I want to configure by environment variable...</p>
  
  <p>I find github issues links (this is getting worse):</p>
  
  <p><a href="https://github.com/spring-projects/spring-integration-kafka/issues/157" rel="nofollow noreferrer">https://github.com/spring-projects/spring-integration-kafka/issues/157</a></p>
  
  <p>This gives a partial clue.</p>
  
  <p>The yml:</p>
  
  <pre><code>spring.kafka.properties.security.protocol: "SSL"
  </code></pre>
  
  <p><em>should work</em>, but doesn't</p>
  
  <p>The yml:</p>
  
  <pre><code>spring:
    kafka:
      properties:
        security.protocol: "SSL"
        ssl.protocol: "SSL"
  </code></pre>
  
  <p><em>DOES</em> work! but it is impossible to represent with environment variables.</p>