New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

io.strimzi:kafka-env-var-config-provider

Package Overview
Dependencies
Maintainers
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io.strimzi:kafka-env-var-config-provider

Apache Kafka configuration provider for reading data from environment variables

  • 1.1.0
  • Source
  • Maven
  • Socket score

Version published
Maintainers
6
Source

Build Status GitHub release Maven Central License Twitter Follow

EnvVar Configuration Provider for Apache Kafka®

Apache Kafka® supports pluggable configuration providers which can load configuration data from external sources. The configuration provider in this repo can be used to load data from environment variables. It can be used in all Kafka components and does not depend on the other Strimzi components. So you could, for example, use it with your producer or consumer applications even if you don't use the Strimzi operators to provide your Kafka cluster. One of the example use-cases is to load certificates or JAAS configuration from environment variables mapped from Kubernetes Secrets.

Using it with Strimzi

From Strimzi Kafka Operators release 0.25.0, the EnvVar Configuration Provider is included in all the Kafka deployments. You can use it for example with Kafka Connect and Kafka Connect connectors. The following example shows how to use it to get a database password from an environment variable in the connector configuration:

  1. Deploy Kafka Connect, enable the EnvVar Configuration Provider and map database password to the DB_PASSWORD environment variable:

    apiVersion: kafka.strimzi.io/v1beta2
    kind: KafkaConnect
    metadata:
      name: my-connect
      annotations:
        strimzi.io/use-connector-resources: "true"
    spec:
      # ...
      config:
        # ...
        config.providers: env
        config.providers.env.class: io.strimzi.kafka.EnvVarConfigProvider
      # ...
      externalConfiguration:
        env:
          - name: DB_PASSWORD
            valueFrom:
              secretKeyRef:
                name: db-creds
                key: dbPassword
      # ...
    
  2. Create the connector:

    apiVersion: kafka.strimzi.io/v1beta2
    kind: KafkaConnector
    metadata:
      name: my-connector
      labels:
        strimzi.io/cluster: my-connect
    spec:
      # ...
      config:
        option: ${env:DB_PASSWORD}
        # ...
    

Adding the EnvVar Configuration Provider to Apache Kafka clients

You can add EnvVar Configuration Provider as any other Java dependency using Maven or any other build tool. For example:

<dependency>
    <groupId>io.strimzi</groupId>
    <artifactId>kafka-env-var-config-provider</artifactId>
    <version>0.1.0</version>
</dependency>

Adding the EnvVar Configuration Provider to Apache Kafka server components

You can also use the EnvVar Configuration Provider with your own Apache Kafka deployments not managed by Strimzi. To add EnvVar Configuration Provider to your own Apache Kafka server distribution, you can download the ZIP or TAR.GZ files frm the GitHub release page and unpack it into Kafka's libs directory.

Using the configuration provider

First, you need to initialize the configuration provider.

config.providers=env
config.providers.env.class=io.strimzi.kafka.EnvVarConfigProvider

Once you initialize it, you can use it to load data from environment variables. For example:

option=${env:MY_ENV_VAR}

Other Strimzi Configuration Providers

If you run Apache Kafka on Kubernetes, you might also be interested in our Kubernetes Configuration Provider.

FAQs

Package last updated on 24 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc