Topic: Protecting Passwords in Environment.rb

Hopefully one of you kittens can help me here. I've set up a few other apps before using SVN and I know how to use something like database.yml.sample and environment.rb.sample, which you customize on the server. I'm having a hard time, though, figuring out how to do the same with Capistrano. If I have to log onto the server after each deploy to edit the configuration I have a feeling I'm doing something wrong. How do you kittens handle this kind of situation. I've looked on the web but can't seem to find a single resource about it much less a capistrano recipe.

Thanks in advance...

RSL

Re: Protecting Passwords in Environment.rb

You need to put the config files in the "shared" directory so they can be accessed across all versions. See this post for details.

Meow

Railscasts - Free Ruby on Rails Screencasts

Re: Protecting Passwords in Environment.rb

Wow! That was quick. I was thinking of that solution but I wasn't [and still amn't] sure where on the local version to put the file to go into shared.

Re: Protecting Passwords in Environment.rb

You mean on your development machine? You would only store the database.yml file that you want to use for your local database there. The server database.yml file should not be on your local or in the SVN repository. It should be in the "shared" directory on the server. Then have capistrano make a link to that every time you deploy (as shown in the linked post).

Railscasts - Free Ruby on Rails Screencasts

Re: Protecting Passwords in Environment.rb

Hrm... Will this work for environment.rb though? I'll be making changes to it from time to time and need to keep a copy in svn. I've actually got a solution for the database.yml file since it was a whole file but only part of environment.rb will need to change.

Re: Protecting Passwords in Environment.rb

If only part of environment.rb will need to change then I recommend extracting that part out into a separate ruby file and including it in environment.rb. This way you can keep one or the other under version control.

Railscasts - Free Ruby on Rails Screencasts

Re: Protecting Passwords in Environment.rb

Looks like a job for YAML, wouldn't you agree?

Thanks for the help.

Re: Protecting Passwords in Environment.rb

RSL wrote:

Looks like a job for YAML, wouldn't you agree?

Depends on what you want to accomplish. If you are just storing mostly static config information, then yes. But if you are extending classes and altering Rails configurations then you would want to keep it in Ruby.

Railscasts - Free Ruby on Rails Screencasts