cockpit icon indicating copy to clipboard operation
cockpit copied to clipboard

Access Cockpit::Settings in initializers

Open treydock opened this issue 13 years ago • 0 comments

I'm having an issue accessing the available settings in an initializer.

Here's the initializer section for Devise

unless Cockpit::Settings["site.external_auth.type"].blank?
  config.omniauth Cockpit::Settings['site.external_auth.type'].to_sym, :host => Cockpit::Settings['site.external_auth.host'], :ssl => Cockpit::Settings['site.external_auth.use_ssl']
end

However this leads to this error when attempting to start the rails app or use console

/home/trey/git/cockpit/lib/cockpit/core/global.rb:10:in `[]': undefined method `[]' for nil:NilClass (NoMethodError)

Typically if Cockpit::Settings was just a subclass of ActiveRecord::Base it would be accessible during app initialization, but I'm having trouble figuring out what to put into a initializer to make things accessible to the various initializers in my app.

treydock avatar Apr 20 '12 18:04 treydock