sinatra file_config gem不能在staging中工作

dev*_*ter 0 yaml sinatra config-files

我正在使用这个宝石,它正在为生产环境和开发工作,但不是在进行分段:

这是main.rb

set :environments, %w{development test production staging}
config_file 'config/config.yml'
Run Code Online (Sandbox Code Playgroud)

和config/config.yml

development: &development
  sub1:
    pay_to_email: test1@gmail.com

test:
  <<: *development

staging:
  <<: *development  

production:
  <<: *development
Run Code Online (Sandbox Code Playgroud)

dev*_*ter 5

弄清楚为什么我必须在寄存器Sinatra :: ConfigFile之后设置它:

 register Sinatra::ConfigFile   
 set :environments, %w{development test production staging}
 config_file 'config/config.yml'
Run Code Online (Sandbox Code Playgroud)