Skip to content

Conversation

@erik-megarad
Copy link

This addresses the issues raised in issue #5.

For our deployment, we must have Cassy config options that are different for each instance running, but which are deterministic based on some easily grabbed config settings on the box. This makes using a yaml file impractical. This pull request allows you to set the configuration in Ruby code, such as in a Rails initializer:

config = ActiveSupport::HashWithIndifferentAccess.new({
  maximum_unused_login_ticket_lifetime: 300,
  maximum_unused_service_ticket_lifetime: 300,
  username_field: 'login',
  client_app_user_field: 'username',
  authenticator: {'class' => 'Cassy::Authenticators::MyApp'},
  service_list: {
    production: ["http://#{my_service_domain}/cas_security_check"],
    development: [
      'http://localhost:8081/cas_security_check',
      'http://localhost:3000/cas_security_check'
    ]
  },
  default_redirect_url: {
    development: 'http://localhost:3000',
    production: "http://#{my_service_domain}"
  },
  loosely_match_services: true
})

Cassy::Engine.config.configuration = config

@qnm
Copy link
Contributor

qnm commented Feb 28, 2013

@subwindow would you mind writing some specs for this change, please?

@erik-megarad
Copy link
Author

Since this happens at Rails boot time, I don't think you can write specs for it. Perhaps if you had a completely separate runner that didn't set ENV["RUBYCAS_CONFIG_FILE"]? Any ideas?

@qnm
Copy link
Contributor

qnm commented Mar 1, 2013

That's a good point.

I see spec_helper has ENV["RUBYCAS_CONFIG_FILE"] hardcoded, perhaps you could set it before spec_helper is loaded in the test? I'll have a dig around later today if I get time.

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants