开发者

Settingslogic missing settings error

I'm having a weird problem with Settingslogic in my Rails a开发者_如何学Cpp.

I have this in config/application.yml:

defaults: &defaults
    redis:
        host: localhost
        port: 6379

development:
    <<: *defaults

    session_key: "_app_development"
    session_secret: "blah_blah_blah"

test:
    <<: *defaults

    session_key: "_app_test"
    session_secret: "blah_blah_blah"

and this in settings.rb:

class Settings < Settingslogic
    source "#{Rails.root}/config/application.yml"

    namespace Rails.env
end

When I try to run "rails server" or "rails console" Settingslogic raises a MissingSetting error on sesssion_secret.

C:/Ruby/1.9.2/lib/ruby/gems/1.9.1/gems/settingslogic-2.0.6/lib/settingslogic.rb:
117:in `method_missing': Missing setting 'session_secret'
in path-to-app/config/application.yml (Settingslogic::MissingSetting).

I'm referencing the session_secret in my secret_token.rb initializer. However, I'm also using Resque in my app and that initializer gets loaded before secret_token.rb and it can access the Redis settings...

Further, if I take out the defaults section and copy the values to the development and test sections Rails will boot.

Like so:

development:
    redis:
        host: localhost
        port: 6379

    session_key: "_app_development"
    session_secret: "blah_blah_blah"

test:
    redis:
        host: localhost
        port: 6379

    session_key: "_app_test"
    session_secret: "blah_blah_blah"

Anyone know why this is happening and how to fix it?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜