awslabs / amazon-kinesis-client-ruby

A Ruby interface for the Amazon Kinesis Client Library. Allows developers to easily create robust application to process Amazon Kinesis streams in Ruby.
Apache License 2.0
146 stars 55 forks source link

Allow properties from the .properties file to be set via environment variables. #20

Open digitalfiz opened 7 years ago

digitalfiz commented 7 years ago

Having to generate this properties file for each environment is not at all 12 factor app. It would be nice if setting STREAM_NAME and others via environment variables overrode properties file values. Kind of like auth works for the sdk.

jqr commented 7 years ago

Yeah I ended up making a script to generate the properties file dynamically using a template so we could have 4 apps all use the same one. I don't have access to that code any more but IIRC you could have it read from STDIN instead of writing to the filesystem.

lancedikson commented 5 years ago

Agree. I'm even overwhelmed with the fact that it doesn't take those properties as env variables.

Cory-Bradshaw commented 4 years ago

Thank you for reporting this feature request. If you or other customers can leave more details on how this impacts your workflows and +1 this issue to help us plan and prioritize this work.

akshaypinto commented 3 years ago

+1

skcc321 commented 3 years ago

+1

cbatson commented 3 years ago

You can use ERB to achieve this. Example:

properties_body = ERB.new(IO.read(Rails.root.join('config/consumer.properties.erb'))).result
properties_file = Rails.root.join('tmp/consumer.properties')
IO.write(properties_file, properties_body)

Then in the consumer.properties.erb file

streamName = <%= ENV['KCL_STREAM_NAME'] %>