I did a quick search and didn’t find anything about this. My project is
getting complex enough that it’d be a real pain to move it to another
server (which will happen in a year or two) because so many paths are
hard coded. Are there any good modules for writing config files for
ruby on rails applications? I’m not strongly attached to any particular
format, I just would like a file in /etc/ that will set a lot of
variables.
Thanks! You’ve all been very helpful
Here’s one way
http://agilewebdevelopment.com/plugins/system_settings
You can make your own yaml file
yml file might look like this
production:
email_server: smtp.mycompany.com
Then load the configuration file in environment.rb (or in a model, or
something else)
c = YAML::load(File.open(File.dirname(FILE) + “/my_config.yml”))
c is now a hash… so get the values from the hash
server = c[RAILS_ENV][“email_server”]
I’ve got a writup on something like this for email configs.
http://www.bphogan.com/learn/pdf/tableless_contact_form.pdf
There’s also a plugin that lets you do system settings:
http://agilewebdevelopment.com/plugins/system_settings
but I’ve not used that one.