Re: How to load the database.yml file again during runtime?

Greg Willits
Sat, 07 Jun 2008 21:23:44 -0000

On Jun 7, 2008, at 1:46 PM, Frederick Cheung wrote:

> On Jun 7, 9:33 pm, Juan Tarquino
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
> wrote:
>> Hi, I have an application that allows the user to make changes to the
>> database.yml file so that he can connect to another database.
>> However I
>> have to manually restart the application to make the changes in
>> database.yml effective. My question is: is there any way of making
>> the
>> changes in database.yml effective from the application code? or at
>> least, is there any way of restarting the application from the
>> application code?

> Don''t know about restarting the app (I suspect not)

I would think you could ping a URL which runs a shell script that
would make the mongrel_cluster calls (or equiv) to restart the app.
Use HTTP authentication for that URL of course, and it''s recommended
to run that URL as https (unless it''s all on a LAN where
you''re not
worried about snooping).

I''ve done this on another platform for a special application case.

I have a local script I use during dev to "restart" rails:

echo "stopping rails..."
mongrel_rails stop /Users/greg/Sites/{path_to_application}/log

echo "starting rails..."
cd /Users/greg/Sites/{path_to_application}
mongrel_rails start -d -p 3001
echo "done"
echo ""

So, something like that with the mongrel_cluster commands and without
the echo feedback.

-- gw


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org