Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@KKNithin
Copy link

  • New docker file for secure kafka dev
  • Modified code to use environment variables
  • Added kafka auth configuration for user along with input required
  • Currently we can use multiple brokers for one cluster with one user

@KKNithin KKNithin self-assigned this Jun 20, 2025
@KKNithin KKNithin added the feature New feature support label Jun 20, 2025
@KKNithin KKNithin linked an issue Jun 20, 2025 that may be closed by this pull request
1 task
@KKNithin KKNithin marked this pull request as draft June 20, 2025 11:12
@KKNithin KKNithin marked this pull request as ready for review June 20, 2025 11:24
@KKNithin KKNithin requested a review from vladoatanasov June 20, 2025 11:24
github.com/IBM/sarama v1.45.2
github.com/gorilla/mux v1.8.1
github.com/jedib0t/go-pretty/v6 v6.6.7
github.com/joho/godotenv v1.5.1
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can load the variables from the env file via Makefile, see here for example. We don't really have a use case for writing the env variables to an env file, so you can remove this library.

s.adminClient = nil
s.isAuthenticated = false
s.version = constants.SaramaKafkaVersion
s.isSecureKafka = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think if you just do s = session{} it will be better. This way you don't have to worry about clearing all the properties from the session object when you want to log out


sessionData := SessionData{Brokers: currentSession.brokers, IsAuthenticated: currentSession.isAuthenticated, Version: currentSession.version.String()}
err = json.NewEncoder(file).Encode(sessionData)
envMap := make(map[string]string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a bit confused, did we move the config file to the env file? I am not a big fan of introducing a third party library for a trivial task like writing to a file, so if we decide this is the direction we want to take, we can easily implement this functionality ourselves.

Or we can have a hybrid solution where the broker metadata is stored in a flat file on disk and only the credentials are preserved in the env variable.

@DuarteMartinho what do you think?

broker = strings.TrimSpace(broker)
if broker == "" {
broker = constants.KafkaBroker
currentSession.isSecureKafka = readUserClosedInput("Is your kafka configured with SASL_PLAINTEXT security? (y/n): ")
Copy link
Collaborator

Choose a reason for hiding this comment

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

the isSecureKafka flag should be changed to isSaslPlaintext, because there are many ways to secure a kafka cluster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authentication Support (SASL_PLAINTEXT)

3 participants