zendesk / racecar

Racecar: a simple framework for Kafka consumers in Ruby
Apache License 2.0
486 stars 93 forks source link

Allow setting King Konf's ignore_unknown_variables #312

Open sean-heller opened 1 year ago

sean-heller commented 1 year ago

When running on Kubernetes, if there are any Service objects with names that start with racecar-, invalid environment variables will be present since Kubernetes provides Service details as environment variables

This results in the error:

unknown environment variable RACECAR_XYZ_EXAMPLE (KingKonf::ConfigError)

King Konf has a setting to get around this by setting ignore_unknown_variables: https://github.com/dasch/king_konf/blob/master/lib/king_konf/config.rb#L14-L16 but we're unable to set that in racecar before it starts up.

Would it be possible to add this?

deepredsky commented 1 year ago

Racecar's config just inherits from KingKonf, so you maybe you can use that configuration by adding something like this in your initializer

Racecar::Config.ignore_unknown_variables true
deepredsky commented 1 year ago

I tested if my example would work. Unfortunately KingKonf immediately initializes configuration from ENV, even before any other configuration are loaded.

jalford14 commented 5 months ago

@sean-heller did you ever find a solution to this? we're running into the same problem here