Extracting CAS configuration into YAML, like database.yml

If you’ve done any enterprise work with Rails, and your shop is using CAS for authentication, chances are you’ve seen rubycas-client. Chances are you’ve also loved how easy it was to get working. There’s usually only one hitch — you’ve got to change the config based on which environment you’re deploying into.

Here’s the standard advice you get from the RDoc:

# in your config/environment.rb
CASClient::Frameworks::Rails::Filter.configure(
  :cas_base_url => "https://cas.example.foo/",
  :proxy_retrieval_url => "https://cas-proxy-callback.example.foo/cas_proxy_callback/retrieve_pgt",
  :proxy_callback_url => "https://cas-proxy-callback.example.foo/cas_proxy_callback/receive_pgt",
  :logger => cas_logger
)

Read more…