Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

feat(config): remove support for configuring kafka broker from env vars #51

Merged

Conversation

smoya
Copy link
Collaborator

@smoya smoya commented Sep 27, 2021

Description

Fixes #50.

This PR drops the option to configure Kafka broker mappings from env vars. Instead, it forces the user to use AsyncAPI, which becomes the main config source from now on.

Related issue(s)
#50

@smoya smoya added the enhancement New feature or request label Sep 27, 2021
kafka/config.go Show resolved Hide resolved
Comment on lines +31 to +33
| EVENTGATEWAY_KAFKA_PROXY_MESSAGE_VALIDATION_ENABLED | boolean | Enable or disable validation of Kafka messages | `true` | No | `true`, `false` |
| EVENTGATEWAY_KAFKA_PROXY_EXTRA_FLAGS | string | Advanced configuration. Configure any flag from [here](https://github.com/grepplabs/kafka-proxy/blob/4f3b89fbaecb3eb82426f5dcff5f76188ea9a9dc/cmd/kafka-proxy/server.go#L85-L195). Multiple values can be configured by using pipe separation (`\|`) | - | No | `tls-enable=true\|tls-client-cert-file=/opt/var/service.cert\|tls-client-key-file=/opt/var/service.key` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any code where you read these values from envs and save them to the KafkaProxy struct. Are you using any env parsing library or are these envs will be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using https://github.com/kelseyhightower/envconfig which is pretty common nowadays.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing puzzles me. Is a variable EVENTGATEWAY_KAFKA_PROXY_MESSAGE_VALIDATION_ENABLED well read if it has suffix _ENABLED and in the structure the variable is without this suffix (MessageValidation)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value we are setting here is the Enabled struct property of MessageValidation. You can see it here: https://github.com/smoya/event-gateway/blob/chore/messagePackage/config/kafka.go#L28.

envconfig works by generating flags with the name based on the structs hierarchy. Let me explain with the example EVENTGATEWAY_KAFKA_PROXY_MESSAGE_VALIDATION_ENABLED:

@smoya smoya merged commit 969e295 into asyncapi-archived-repos:master Sep 28, 2021
@smoya smoya deleted the feat/brokerConfigFromDoc branch September 28, 2021 10:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop support for configuring Kafka broker mappings through env vars.
2 participants