Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config not loaded automatically for a producer in Rails. #329

Open
jcoyne opened this issue Apr 4, 2023 · 1 comment
Open

Config not loaded automatically for a producer in Rails. #329

jcoyne opened this issue Apr 4, 2023 · 1 comment

Comments

@jcoyne
Copy link

jcoyne commented Apr 4, 2023

If I have a Rails controller that does:

Racecar.produce_sync(...)

it will not get the config loaded from config/racecar.rb or config/racecar.yml

it is only loaded in the CLI (for the consumer):

RailsConfigFileLoader.load! unless config.without_rails?
if File.exist?("config/racecar.rb")
require "./config/racecar"
end

@jcoyne jcoyne changed the title Config not loaded automatically in rails. Config not loaded for producer automatically in rails. Apr 4, 2023
@jcoyne jcoyne changed the title Config not loaded for producer automatically in rails. Config not loaded automatically for a producer in Rails. Apr 4, 2023
@deepredsky
Copy link
Contributor

Standalone producer does not seem to load rails config by default. I will look into fixing that. Meanwhile you can load it manually in a rails initializer, something like this

# file config/initializers/racecar.rb
Racecar.config.load_file("config/racecar.yml", ENV["RAILS_ENV"])

Alternatively you could configure racecar directly in the initializer

Racecar.configure do |config|
  config.brokers = 'localhost:9092'
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants