Move configuration to yml file.
Is it possible, to move this block to yaml file?
Backburner.configure do |config|
...
end
Its needed, when you have different configurations for development, staging and production. Or is there any other convenient way to split configuration?
Yes you could, I actually do have mine in a YML file for my projects:
BACKBURNER_CONFIG = YAML.load_file("path/to/yml")[Padrino.env]
Backburner.configure do |config|
config.something = BACKBURNER_CONFIG['something']
end
Since Backburner can be used from sinatra, rails and padrino, I like to leave this up to the user's discretion.
Any sample yaml files with all available options? Or they are named exactly as in ruby?
Yep, you got it named based on the ruby:
---
beanstalk_url: "beanstalk://127.0.0.1"
tube_namespace: "some-app-production"
max_job_retries: 3
etc. You can even do something like:
Backburner.configure do |config|
BACKBURNER_CONFIG.keys.each do |k, v|
config.send("#{k}=", v)
end
end
I think it's not very convenient way to load config. Maybe, it's better to make something like sidekiq -C config file path? Also, way with send is not good I think because of send. Is it possible to pass pid path to config?
Yeah I see your point, I like the idea of having a -C flag passable into the bin to configure the settings. Will do for a future version or accept a pull request.
Why not a .rb configuration file like unicorn? That way one can still have the ability to do some preprocessing, load things from ENV etc.
Just a simple YML file is too restrictive.
Not a bad point, it could be a .rb configuration file but then how different is that from the configure block we have now? What would you propose for the DSL?
Exactly... it would bear no difference at all. The DSL would be the same, it's only a matter of loading the specified file at the correct moment. It would be similar to having different configurations in config/environments/*.rb files, but using a separate file. And not having to depend on rails environment magic.
Ah I see, yeah that makes sense.